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

Side by Side Diff: src/api-natives.cc

Issue 2741683004: [rename] Rename internal field to embedder field. (Closed)
Patch Set: [rename] Rename internal field to embedder field. 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
« no previous file with comments | « src/api.cc ('k') | src/bootstrapper.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "src/api-natives.h" 5 #include "src/api-natives.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/isolate-inl.h" 8 #include "src/isolate-inl.h"
9 #include "src/lookup.h" 9 #include "src/lookup.h"
10 #include "src/messages.h" 10 #include "src/messages.h"
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 529
530 MaybeHandle<JSObject> ApiNatives::InstantiateRemoteObject( 530 MaybeHandle<JSObject> ApiNatives::InstantiateRemoteObject(
531 Handle<ObjectTemplateInfo> data) { 531 Handle<ObjectTemplateInfo> data) {
532 Isolate* isolate = data->GetIsolate(); 532 Isolate* isolate = data->GetIsolate();
533 InvokeScope invoke_scope(isolate); 533 InvokeScope invoke_scope(isolate);
534 534
535 Handle<FunctionTemplateInfo> constructor( 535 Handle<FunctionTemplateInfo> constructor(
536 FunctionTemplateInfo::cast(data->constructor())); 536 FunctionTemplateInfo::cast(data->constructor()));
537 Handle<Map> object_map = isolate->factory()->NewMap( 537 Handle<Map> object_map = isolate->factory()->NewMap(
538 JS_SPECIAL_API_OBJECT_TYPE, 538 JS_SPECIAL_API_OBJECT_TYPE,
539 JSObject::kHeaderSize + data->internal_field_count() * kPointerSize, 539 JSObject::kHeaderSize + data->embedder_field_count() * kPointerSize,
540 FAST_HOLEY_SMI_ELEMENTS); 540 FAST_HOLEY_SMI_ELEMENTS);
541 object_map->SetConstructor(*constructor); 541 object_map->SetConstructor(*constructor);
542 object_map->set_is_access_check_needed(true); 542 object_map->set_is_access_check_needed(true);
543 543
544 Handle<JSObject> object = isolate->factory()->NewJSObjectFromMap(object_map); 544 Handle<JSObject> object = isolate->factory()->NewJSObjectFromMap(object_map);
545 JSObject::ForceSetPrototype(object, isolate->factory()->null_value()); 545 JSObject::ForceSetPrototype(object, isolate->factory()->null_value());
546 546
547 return object; 547 return object;
548 } 548 }
549 549
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 } 624 }
625 625
626 if (prototype->IsTheHole(isolate)) { 626 if (prototype->IsTheHole(isolate)) {
627 prototype = isolate->factory()->NewFunctionPrototype(result); 627 prototype = isolate->factory()->NewFunctionPrototype(result);
628 } else if (obj->prototype_provider_template()->IsUndefined(isolate)) { 628 } else if (obj->prototype_provider_template()->IsUndefined(isolate)) {
629 JSObject::AddProperty(Handle<JSObject>::cast(prototype), 629 JSObject::AddProperty(Handle<JSObject>::cast(prototype),
630 isolate->factory()->constructor_string(), result, 630 isolate->factory()->constructor_string(), result,
631 DONT_ENUM); 631 DONT_ENUM);
632 } 632 }
633 633
634 int internal_field_count = 0; 634 int embedder_field_count = 0;
635 bool immutable_proto = false; 635 bool immutable_proto = false;
636 if (!obj->instance_template()->IsUndefined(isolate)) { 636 if (!obj->instance_template()->IsUndefined(isolate)) {
637 Handle<ObjectTemplateInfo> instance_template = Handle<ObjectTemplateInfo>( 637 Handle<ObjectTemplateInfo> instance_template = Handle<ObjectTemplateInfo>(
638 ObjectTemplateInfo::cast(obj->instance_template())); 638 ObjectTemplateInfo::cast(obj->instance_template()));
639 internal_field_count = instance_template->internal_field_count(); 639 embedder_field_count = instance_template->embedder_field_count();
640 immutable_proto = instance_template->immutable_proto(); 640 immutable_proto = instance_template->immutable_proto();
641 } 641 }
642 642
643 // TODO(svenpanne) Kill ApiInstanceType and refactor things by generalizing 643 // TODO(svenpanne) Kill ApiInstanceType and refactor things by generalizing
644 // JSObject::GetHeaderSize. 644 // JSObject::GetHeaderSize.
645 int instance_size = kPointerSize * internal_field_count; 645 int instance_size = kPointerSize * embedder_field_count;
646 InstanceType type; 646 InstanceType type;
647 switch (instance_type) { 647 switch (instance_type) {
648 case JavaScriptObjectType: 648 case JavaScriptObjectType:
649 if (!obj->needs_access_check() && 649 if (!obj->needs_access_check() &&
650 obj->named_property_handler()->IsUndefined(isolate) && 650 obj->named_property_handler()->IsUndefined(isolate) &&
651 obj->indexed_property_handler()->IsUndefined(isolate)) { 651 obj->indexed_property_handler()->IsUndefined(isolate)) {
652 type = JS_API_OBJECT_TYPE; 652 type = JS_API_OBJECT_TYPE;
653 } else { 653 } else {
654 type = JS_SPECIAL_API_OBJECT_TYPE; 654 type = JS_SPECIAL_API_OBJECT_TYPE;
655 } 655 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 map->set_is_constructor(true); 703 map->set_is_constructor(true);
704 } 704 }
705 705
706 if (immutable_proto) map->set_immutable_proto(true); 706 if (immutable_proto) map->set_immutable_proto(true);
707 707
708 return result; 708 return result;
709 } 709 }
710 710
711 } // namespace internal 711 } // namespace internal
712 } // namespace v8 712 } // namespace v8
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/bootstrapper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698