| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <stdlib.h> | 5 #include <stdlib.h> |
| 6 | 6 |
| 7 #include "test/cctest/test-api.h" | 7 #include "test/cctest/test-api.h" |
| 8 | 8 |
| 9 #include "include/v8-util.h" | 9 #include "include/v8-util.h" |
| 10 #include "src/api.h" | 10 #include "src/api.h" |
| (...skipping 4540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4551 "result"); | 4551 "result"); |
| 4552 CHECK(!result->IsArray()); | 4552 CHECK(!result->IsArray()); |
| 4553 CHECK(v8_num(43)->Equals(context.local(), result).FromJust()); | 4553 CHECK(v8_num(43)->Equals(context.local(), result).FromJust()); |
| 4554 } | 4554 } |
| 4555 | 4555 |
| 4556 namespace { | 4556 namespace { |
| 4557 | 4557 |
| 4558 template <typename T> | 4558 template <typename T> |
| 4559 Local<Object> BuildWrappedObject(v8::Isolate* isolate, T* data) { | 4559 Local<Object> BuildWrappedObject(v8::Isolate* isolate, T* data) { |
| 4560 auto templ = v8::ObjectTemplate::New(isolate); | 4560 auto templ = v8::ObjectTemplate::New(isolate); |
| 4561 templ->SetInternalFieldCount(1); | 4561 templ->SetEmbedderFieldCount(1); |
| 4562 auto instance = | 4562 auto instance = |
| 4563 templ->NewInstance(isolate->GetCurrentContext()).ToLocalChecked(); | 4563 templ->NewInstance(isolate->GetCurrentContext()).ToLocalChecked(); |
| 4564 instance->SetAlignedPointerInInternalField(0, data); | 4564 instance->SetAlignedPointerInEmbedderField(0, data); |
| 4565 return instance; | 4565 return instance; |
| 4566 } | 4566 } |
| 4567 | 4567 |
| 4568 | 4568 |
| 4569 template <typename T> | 4569 template <typename T> |
| 4570 T* GetWrappedObject(Local<Value> data) { | 4570 T* GetWrappedObject(Local<Value> data) { |
| 4571 return reinterpret_cast<T*>( | 4571 return reinterpret_cast<T*>( |
| 4572 Object::Cast(*data)->GetAlignedPointerFromInternalField(0)); | 4572 Object::Cast(*data)->GetAlignedPointerFromEmbedderField(0)); |
| 4573 } | 4573 } |
| 4574 | 4574 |
| 4575 | 4575 |
| 4576 struct AccessCheckData { | 4576 struct AccessCheckData { |
| 4577 int count; | 4577 int count; |
| 4578 bool result; | 4578 bool result; |
| 4579 }; | 4579 }; |
| 4580 | 4580 |
| 4581 AccessCheckData* g_access_check_data = nullptr; | 4581 AccessCheckData* g_access_check_data = nullptr; |
| 4582 | 4582 |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5014 ->Set(env.local(), v8_str("Fun"), | 5014 ->Set(env.local(), v8_str("Fun"), |
| 5015 fun_templ->GetFunction(env.local()).ToLocalChecked()) | 5015 fun_templ->GetFunction(env.local()).ToLocalChecked()) |
| 5016 .FromJust()); | 5016 .FromJust()); |
| 5017 | 5017 |
| 5018 CompileRun( | 5018 CompileRun( |
| 5019 "var f = new Fun();" | 5019 "var f = new Fun();" |
| 5020 "Number.prototype.__proto__ = f;" | 5020 "Number.prototype.__proto__ = f;" |
| 5021 "var a = 42;" | 5021 "var a = 42;" |
| 5022 "for (var i = 0; i<3; i++) { a.foo; }"); | 5022 "for (var i = 0; i<3; i++) { a.foo; }"); |
| 5023 } | 5023 } |
| OLD | NEW |