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

Side by Side Diff: src/bootstrapper.cc

Issue 2624903003: [runtime] Use PropertyKind/PropertyLocation instead of PropertyType. (Closed)
Patch Set: Addressing comments Created 3 years, 11 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 | « no previous file | src/compiler/access-info.cc » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/bootstrapper.h" 5 #include "src/bootstrapper.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api-natives.h" 8 #include "src/api-natives.h"
9 #include "src/base/ieee754.h" 9 #include "src/base/ieee754.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 4342 matching lines...) Expand 10 before | Expand all | Expand 10 after
4353 // If JSObject::AddProperty asserts due to already existing property, 4353 // If JSObject::AddProperty asserts due to already existing property,
4354 // it is likely due to both global objects sharing property name(s). 4354 // it is likely due to both global objects sharing property name(s).
4355 // Merging those two global objects is impossible. 4355 // Merging those two global objects is impossible.
4356 // The global template must not create properties that already exist 4356 // The global template must not create properties that already exist
4357 // in the snapshotted global object. 4357 // in the snapshotted global object.
4358 if (from->HasFastProperties()) { 4358 if (from->HasFastProperties()) {
4359 Handle<DescriptorArray> descs = 4359 Handle<DescriptorArray> descs =
4360 Handle<DescriptorArray>(from->map()->instance_descriptors()); 4360 Handle<DescriptorArray>(from->map()->instance_descriptors());
4361 for (int i = 0; i < from->map()->NumberOfOwnDescriptors(); i++) { 4361 for (int i = 0; i < from->map()->NumberOfOwnDescriptors(); i++) {
4362 PropertyDetails details = descs->GetDetails(i); 4362 PropertyDetails details = descs->GetDetails(i);
4363 switch (details.type()) { 4363 if (details.location() == kField) {
4364 case DATA: { 4364 if (details.kind() == kData) {
4365 HandleScope inner(isolate()); 4365 HandleScope inner(isolate());
4366 Handle<Name> key = Handle<Name>(descs->GetKey(i)); 4366 Handle<Name> key = Handle<Name>(descs->GetKey(i));
4367 FieldIndex index = FieldIndex::ForDescriptor(from->map(), i); 4367 FieldIndex index = FieldIndex::ForDescriptor(from->map(), i);
4368 DCHECK(!descs->GetDetails(i).representation().IsDouble()); 4368 DCHECK(!descs->GetDetails(i).representation().IsDouble());
4369 Handle<Object> value = Handle<Object>(from->RawFastPropertyAt(index), 4369 Handle<Object> value = Handle<Object>(from->RawFastPropertyAt(index),
4370 isolate()); 4370 isolate());
4371 JSObject::AddProperty(to, key, value, details.attributes()); 4371 JSObject::AddProperty(to, key, value, details.attributes());
4372 break; 4372 } else {
4373 DCHECK_EQ(kAccessor, details.kind());
4374 UNREACHABLE();
4373 } 4375 }
4374 case DATA_CONSTANT: { 4376
4377 } else {
4378 DCHECK_EQ(kDescriptor, details.location());
4379 if (details.kind() == kData) {
4375 HandleScope inner(isolate()); 4380 HandleScope inner(isolate());
4376 Handle<Name> key = Handle<Name>(descs->GetKey(i)); 4381 Handle<Name> key = Handle<Name>(descs->GetKey(i));
4377 Handle<Object> constant(descs->GetConstant(i), isolate()); 4382 Handle<Object> constant(descs->GetConstant(i), isolate());
4378 JSObject::AddProperty(to, key, constant, details.attributes()); 4383 JSObject::AddProperty(to, key, constant, details.attributes());
4379 break; 4384
4380 } 4385 } else {
4381 case ACCESSOR: 4386 DCHECK_EQ(kAccessor, details.kind());
4382 UNREACHABLE();
4383 case ACCESSOR_CONSTANT: {
4384 Handle<Name> key(descs->GetKey(i)); 4387 Handle<Name> key(descs->GetKey(i));
4385 LookupIterator it(to, key, LookupIterator::OWN_SKIP_INTERCEPTOR); 4388 LookupIterator it(to, key, LookupIterator::OWN_SKIP_INTERCEPTOR);
4386 CHECK_NE(LookupIterator::ACCESS_CHECK, it.state()); 4389 CHECK_NE(LookupIterator::ACCESS_CHECK, it.state());
4387 // If the property is already there we skip it 4390 // If the property is already there we skip it
4388 if (it.IsFound()) continue; 4391 if (it.IsFound()) continue;
4389 HandleScope inner(isolate()); 4392 HandleScope inner(isolate());
4390 DCHECK(!to->HasFastProperties()); 4393 DCHECK(!to->HasFastProperties());
4391 // Add to dictionary. 4394 // Add to dictionary.
4392 Handle<Object> callbacks(descs->GetCallbacksObject(i), isolate()); 4395 Handle<Object> callbacks(descs->GetCallbacksObject(i), isolate());
4393 PropertyDetails d(details.attributes(), ACCESSOR_CONSTANT, i + 1, 4396 PropertyDetails d(details.attributes(), ACCESSOR_CONSTANT, i + 1,
4394 PropertyCellType::kMutable); 4397 PropertyCellType::kMutable);
4395 JSObject::SetNormalizedProperty(to, key, callbacks, d); 4398 JSObject::SetNormalizedProperty(to, key, callbacks, d);
4396 break;
4397 } 4399 }
4398 } 4400 }
4399 } 4401 }
4400 } else if (from->IsJSGlobalObject()) { 4402 } else if (from->IsJSGlobalObject()) {
4401 // Copy all keys and values in enumeration order. 4403 // Copy all keys and values in enumeration order.
4402 Handle<GlobalDictionary> properties = 4404 Handle<GlobalDictionary> properties =
4403 Handle<GlobalDictionary>(from->global_dictionary()); 4405 Handle<GlobalDictionary>(from->global_dictionary());
4404 Handle<FixedArray> key_indices = 4406 Handle<FixedArray> key_indices =
4405 GlobalDictionary::IterationIndices(properties); 4407 GlobalDictionary::IterationIndices(properties);
4406 for (int i = 0; i < key_indices->length(); i++) { 4408 for (int i = 0; i < key_indices->length(); i++) {
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
4740 } 4742 }
4741 4743
4742 4744
4743 // Called when the top-level V8 mutex is destroyed. 4745 // Called when the top-level V8 mutex is destroyed.
4744 void Bootstrapper::FreeThreadResources() { 4746 void Bootstrapper::FreeThreadResources() {
4745 DCHECK(!IsActive()); 4747 DCHECK(!IsActive());
4746 } 4748 }
4747 4749
4748 } // namespace internal 4750 } // namespace internal
4749 } // namespace v8 4751 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/access-info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698