Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: test/cctest/test-api-interceptors.cc

Issue 2741683004: [rename] Rename internal field to embedder field. (Closed)
Patch Set: DEPRECATE_SOON(GetInternalField) Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698