Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bring in 5.1 - 5.0 abi compatibility #23

Closed
wants to merge 2 commits into from
Closed

Bring in 5.1 - 5.0 abi compatibility #23

wants to merge 2 commits into from

Conversation

matthewloring
Copy link

No description provided.

@ofrobots
Copy link
Owner

ofrobots commented May 20, 2016

Good work! Looking at the diff from v8.h in 5.0, there is still this ABI difference remaining:

@@ -7149,7 +7323,7 @@ class Internals {
       1 * kApiPointerSize + kApiIntSize;
   static const int kStringResourceOffset = 3 * kApiPointerSize;

-  static const int kOddballKindOffset = 4 * kApiPointerSize;
+  static const int kOddballKindOffset = 5 * kApiPointerSize;
   static const int kForeignAddressOffset = kApiPointerSize;

@matthewloring
Copy link
Author

That should be fixed now.

@ofrobots
Copy link
Owner

ofrobots commented May 21, 2016

Looking at some of the other include/ files, a few more differences. These should be easy to fix however:

--- a/deps/v8/include/v8-debug.h
+++ b/deps/v8/include/v8-debug.h
@@ -18,13 +18,11 @@ enum DebugEvent {
   Exception = 2,
   NewFunction = 3,
   BeforeCompile = 4,
-  AfterCompile  = 5,
+  AfterCompile = 5,
   CompileError = 6,
-  PromiseEvent = 7,
-  AsyncTaskEvent = 8,
+  AsyncTaskEvent = 7,
 };
--- a/deps/v8/include/v8-platform.h
+++ b/deps/v8/include/v8-platform.h
@@ -152,9 +152,9 @@ class Platform {
    */
   virtual uint64_t AddTraceEvent(
       char phase, const uint8_t* category_enabled_flag, const char* name,
-      uint64_t id, uint64_t bind_id, int32_t num_args, const char** arg_names,
-      const uint8_t* arg_types, const uint64_t* arg_values,
-      unsigned int flags) {
+      const char* scope, uint64_t id, uint64_t bind_id, int32_t num_args,
+      const char** arg_names, const uint8_t* arg_types,
+      const uint64_t* arg_values, unsigned int flags) {
     return 0;
   }

@matthewloring
Copy link
Author

These should now be compatible.

JS_MESSAGE_OBJECT_TYPE,
JS_DATE_TYPE,
JS_OBJECT_TYPE,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Swapping this back around will be bad for performance, since we perform range checks on LAST_SPECIAL_RECEIVER_TYPE and LAST_CUSTOM_ELEMENTS_RECEIVER. If JS_OBJECT_TYPE falls above, all JS_OBJECT_TYPE objects (most common JavaScript object) will take the slow path for e.g., .hasOwnProperty.

@matthewloring
Copy link
Author

I added custom checks for JS_OBJECT_TYPE at the comparison points to LAST_CUSTOM_ELEMENTS_RECEIVER. Using this contrived benchmark:

var o = {};
for (var i = 0; i < 10000000; i++) {
  Object.assign(o, { i: i });
  for (var k in o) {
    if (!o.hasOwnProperty(k)) {
      console.log('fail');
    }
  }
}

I observed:

mattloring-macbookpro:node mattloring$ time node-6.1.0 ~/Desktop/slow-test.js

real    0m1.985s
user    0m1.961s
sys 0m0.019s
mattloring-macbookpro:node mattloring$ time out/Release/node-old ~/Desktop/slow-test.js

real    0m25.168s
user    0m24.408s
sys 0m0.095s
mattloring-macbookpro:node mattloring$ time out/Release/node-fast ~/Desktop/slow-test.js

real    0m2.104s
user    0m1.960s
sys 0m0.016s

@ofrobots @verwaest What do you think?

LAST_CUSTOM_ELEMENTS_RECEIVER)),
assembler->Word32NotEqual(
instance_type, assembler->Int32Constant(
JS_OBJECT_TYPE))),
Copy link
Owner

@ofrobots ofrobots May 25, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is not right. JS_SPECIAL_API_OBJECT_TYPE used to be <= LAST_CUSTOM_ELEMENTS_RECEIVER before your change, but is > after your change. JS_OBJECT_TYPE is invariant here.

I think the expression you want is:

OR (
     LESS_EQUAL (instance_type, LAST_CUSTOM_ELEMENTS_RECEIVER
     EQUAL(instance_type, JS_SPECIAL_API_OBJECT_TYPE))

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@ofrobots
Copy link
Owner

LGTM to me. Let's get @verwaest to review as well.

@targos
Copy link

targos commented May 31, 2016

There is now v8/v8@ea5e96f in the 5.1 branch. Do you have to make changes for that?

@verwaest-zz
Copy link

LGTM as well.

@matthewloring
Copy link
Author

I've updated the patch to support v8/v8@ea5e96f.

@ofrobots
Copy link
Owner

ofrobots commented Jun 1, 2016

LGTM. @jeisinger PTAL as well.

@jeisinger
Copy link

LGTM

@targos
Copy link

targos commented Jun 2, 2016

@matthewloring If everything is ready, could you squash the commits so I can pick them up in nodejs#7016 ?

@matthewloring
Copy link
Author

@targos All squashed.

@targos
Copy link

targos commented Jun 3, 2016

The patch does not apply cleanly on my branch

@ofrobots
Copy link
Owner

ofrobots commented Jun 3, 2016

Actually this PR needs more work. Intercepted enumerator tests are failing for me.

@matthewloring I think the problem is that JS_SPECIAL_API_OBJECT_TYPE has been reordered wrt. LAST_CUSTOM_ELEMENTS_RECEIVER. API objects (with interceptors) no longer look like they require custom elements iteration breaking enumerator tests.

@targos: this is not likely to be ready before next week.

@@ -20,7 +20,8 @@ enum DebugEvent {
BeforeCompile = 4,
AfterCompile = 5,
CompileError = 6,
AsyncTaskEvent = 7,
PromiseEvent = 7,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at this more closely, I think the removal of PromiseEvent was actually an API change that is missing from the official list (/cc @natorion). I think we will have bring this back as a revert of https://codereview.chromium.org/1833563002.

@@ -223,7 +223,8 @@ inline bool PrototypeHasNoElements(Isolate* isolate, JSObject* object) {
HeapObject* empty = isolate->heap()->empty_fixed_array();
while (prototype != null) {
Map* map = prototype->map();
if (map->instance_type() <= LAST_CUSTOM_ELEMENTS_RECEIVER) return false;
if (map->instance_type() <= LAST_CUSTOM_ELEMENTS_RECEIVER ||
map->instance_type() == JS_GLOBAL_PROXY_TYPE) return false;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: align with the previous line.

Matt Loring added 2 commits June 6, 2016 17:13
@ofrobots
Copy link
Owner

ofrobots commented Jun 7, 2016

LGTM from my side. Given that that the roots list was reordered; it would be good to get signoff from @verwaest or @jeisinger as well.

@jeisinger
Copy link

lgtm

@ofrobots
Copy link
Owner

ofrobots commented Jun 7, 2016

Launched a CI: https://ci.nodejs.org/job/node-test-commit/3684/
@targos this is rebased on top of your branch.

targos pushed a commit to targos/node that referenced this pull request Jun 29, 2016
The removal of the promise debug event is an API/ABI breaking change.

Ref: https://codereview.chromium.org/1833563002
Ref: ofrobots#23

PR-URL: nodejs#7016
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
targos pushed a commit to targos/node that referenced this pull request Jun 29, 2016
Ref: ofrobots#23

PR-URL: nodejs#7016
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
targos pushed a commit to nodejs/node that referenced this pull request Jun 29, 2016
The removal of the promise debug event is an API/ABI breaking change.

Ref: https://codereview.chromium.org/1833563002
Ref: ofrobots#23

PR-URL: #7016
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
targos pushed a commit to nodejs/node that referenced this pull request Jun 29, 2016
Ref: ofrobots#23

PR-URL: #7016
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
@matthewloring
Copy link
Author

Closing this as it has landed in core.

ofrobots pushed a commit that referenced this pull request Aug 25, 2016
The removal of the promise debug event is an API/ABI breaking change.

Ref: https://codereview.chromium.org/1833563002
Ref: #23

PR-URL: nodejs#7016
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
ofrobots pushed a commit that referenced this pull request Aug 25, 2016
Ref: #23

PR-URL: nodejs#7016
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants