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

Side by Side Diff: src/heap/heap.cc

Issue 2741683004: [rename] Rename internal field to embedder field. (Closed)
Patch Set: Remove API changes 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/global-handles.cc ('k') | src/i18n.cc » ('j') | src/objects.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/heap/heap.h" 5 #include "src/heap/heap.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api.h" 8 #include "src/api.h"
9 #include "src/assembler-inl.h" 9 #include "src/assembler-inl.h"
10 #include "src/ast/context-slot-cache.h" 10 #include "src/ast/context-slot-cache.h"
(...skipping 3485 matching lines...) Expand 10 before | Expand all | Expand 10 after
3496 // for example, JSArray::JSArrayVerify). 3496 // for example, JSArray::JSArrayVerify).
3497 InitializeJSObjectBody(obj, map, JSObject::kHeaderSize); 3497 InitializeJSObjectBody(obj, map, JSObject::kHeaderSize);
3498 } 3498 }
3499 3499
3500 3500
3501 void Heap::InitializeJSObjectBody(JSObject* obj, Map* map, int start_offset) { 3501 void Heap::InitializeJSObjectBody(JSObject* obj, Map* map, int start_offset) {
3502 if (start_offset == map->instance_size()) return; 3502 if (start_offset == map->instance_size()) return;
3503 DCHECK_LT(start_offset, map->instance_size()); 3503 DCHECK_LT(start_offset, map->instance_size());
3504 3504
3505 // We cannot always fill with one_pointer_filler_map because objects 3505 // We cannot always fill with one_pointer_filler_map because objects
3506 // created from API functions expect their internal fields to be initialized 3506 // created from API functions expect their embedder fields to be initialized
3507 // with undefined_value. 3507 // with undefined_value.
3508 // Pre-allocated fields need to be initialized with undefined_value as well 3508 // Pre-allocated fields need to be initialized with undefined_value as well
3509 // so that object accesses before the constructor completes (e.g. in the 3509 // so that object accesses before the constructor completes (e.g. in the
3510 // debugger) will not cause a crash. 3510 // debugger) will not cause a crash.
3511 3511
3512 // In case of Array subclassing the |map| could already be transitioned 3512 // In case of Array subclassing the |map| could already be transitioned
3513 // to different elements kind from the initial map on which we track slack. 3513 // to different elements kind from the initial map on which we track slack.
3514 bool in_progress = map->IsInobjectSlackTrackingInProgress(); 3514 bool in_progress = map->IsInobjectSlackTrackingInProgress();
3515 Object* filler; 3515 Object* filler;
3516 if (in_progress) { 3516 if (in_progress) {
(...skipping 2098 matching lines...) Expand 10 before | Expand all | Expand 10 after
5615 deserialization_complete_ = true; 5615 deserialization_complete_ = true;
5616 } 5616 }
5617 5617
5618 void Heap::SetEmbedderHeapTracer(EmbedderHeapTracer* tracer) { 5618 void Heap::SetEmbedderHeapTracer(EmbedderHeapTracer* tracer) {
5619 DCHECK_EQ(gc_state_, HeapState::NOT_IN_GC); 5619 DCHECK_EQ(gc_state_, HeapState::NOT_IN_GC);
5620 local_embedder_heap_tracer()->SetRemoteTracer(tracer); 5620 local_embedder_heap_tracer()->SetRemoteTracer(tracer);
5621 } 5621 }
5622 5622
5623 void Heap::TracePossibleWrapper(JSObject* js_object) { 5623 void Heap::TracePossibleWrapper(JSObject* js_object) {
5624 DCHECK(js_object->WasConstructedFromApiFunction()); 5624 DCHECK(js_object->WasConstructedFromApiFunction());
5625 if (js_object->GetInternalFieldCount() >= 2 && 5625 if (js_object->GetEmbedderFieldCount() >= 2 &&
5626 js_object->GetInternalField(0) && 5626 js_object->GetEmbedderField(0) &&
5627 js_object->GetInternalField(0) != undefined_value() && 5627 js_object->GetEmbedderField(0) != undefined_value() &&
5628 js_object->GetInternalField(1) != undefined_value()) { 5628 js_object->GetEmbedderField(1) != undefined_value()) {
5629 DCHECK(reinterpret_cast<intptr_t>(js_object->GetInternalField(0)) % 2 == 0); 5629 DCHECK(reinterpret_cast<intptr_t>(js_object->GetEmbedderField(0)) % 2 == 0);
5630 local_embedder_heap_tracer()->AddWrapperToTrace(std::pair<void*, void*>( 5630 local_embedder_heap_tracer()->AddWrapperToTrace(std::pair<void*, void*>(
5631 reinterpret_cast<void*>(js_object->GetInternalField(0)), 5631 reinterpret_cast<void*>(js_object->GetEmbedderField(0)),
5632 reinterpret_cast<void*>(js_object->GetInternalField(1)))); 5632 reinterpret_cast<void*>(js_object->GetEmbedderField(1))));
5633 } 5633 }
5634 } 5634 }
5635 5635
5636 void Heap::RegisterExternallyReferencedObject(Object** object) { 5636 void Heap::RegisterExternallyReferencedObject(Object** object) {
5637 HeapObject* heap_object = HeapObject::cast(*object); 5637 HeapObject* heap_object = HeapObject::cast(*object);
5638 DCHECK(Contains(heap_object)); 5638 DCHECK(Contains(heap_object));
5639 if (FLAG_incremental_marking_wrappers && incremental_marking()->IsMarking()) { 5639 if (FLAG_incremental_marking_wrappers && incremental_marking()->IsMarking()) {
5640 IncrementalMarking::MarkGrey(this, heap_object); 5640 IncrementalMarking::MarkGrey(this, heap_object);
5641 } else { 5641 } else {
5642 DCHECK(mark_compact_collector()->in_use()); 5642 DCHECK(mark_compact_collector()->in_use());
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after
6365 } 6365 }
6366 6366
6367 6367
6368 // static 6368 // static
6369 int Heap::GetStaticVisitorIdForMap(Map* map) { 6369 int Heap::GetStaticVisitorIdForMap(Map* map) {
6370 return StaticVisitorBase::GetVisitorId(map); 6370 return StaticVisitorBase::GetVisitorId(map);
6371 } 6371 }
6372 6372
6373 } // namespace internal 6373 } // namespace internal
6374 } // namespace v8 6374 } // namespace v8
OLDNEW
« no previous file with comments | « src/global-handles.cc ('k') | src/i18n.cc » ('j') | src/objects.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698