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

Side by Side Diff: src/property-descriptor.cc

Issue 1108013003: Introduce --zap-cpp-pointers (off by default) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fixes Created 3 years, 7 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/objects.h ('k') | src/regexp/regexp-macro-assembler.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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/property-descriptor.h" 5 #include "src/property-descriptor.h"
6 6
7 #include "src/bootstrapper.h" 7 #include "src/bootstrapper.h"
8 #include "src/factory.h" 8 #include "src/factory.h"
9 #include "src/isolate-inl.h" 9 #include "src/isolate-inl.h"
10 #include "src/lookup.h" 10 #include "src/lookup.h"
(...skipping 24 matching lines...) Expand all
35 } 35 }
36 36
37 37
38 // Helper function for ToPropertyDescriptor. Handles the case of "simple" 38 // Helper function for ToPropertyDescriptor. Handles the case of "simple"
39 // objects: nothing on the prototype chain, just own fast data properties. 39 // objects: nothing on the prototype chain, just own fast data properties.
40 // Must not have observable side effects, because the slow path will restart 40 // Must not have observable side effects, because the slow path will restart
41 // the entire conversion! 41 // the entire conversion!
42 bool ToPropertyDescriptorFastPath(Isolate* isolate, Handle<JSReceiver> obj, 42 bool ToPropertyDescriptorFastPath(Isolate* isolate, Handle<JSReceiver> obj,
43 PropertyDescriptor* desc) { 43 PropertyDescriptor* desc) {
44 if (!obj->IsJSObject()) return false; 44 if (!obj->IsJSObject()) return false;
45 Map* map = Handle<JSObject>::cast(obj)->map(); 45 Handle<Map> map = handle(Handle<JSObject>::cast(obj)->map(), isolate);
46 if (map->instance_type() != JS_OBJECT_TYPE) return false; 46 if (map->instance_type() != JS_OBJECT_TYPE) return false;
47 if (map->is_access_check_needed()) return false; 47 if (map->is_access_check_needed()) return false;
48 if (map->prototype() != *isolate->initial_object_prototype()) return false; 48 if (map->prototype() != *isolate->initial_object_prototype()) return false;
49 // During bootstrapping, the object_function_prototype_map hasn't been 49 // During bootstrapping, the object_function_prototype_map hasn't been
50 // set up yet. 50 // set up yet.
51 if (isolate->bootstrapper()->IsActive()) return false; 51 if (isolate->bootstrapper()->IsActive()) return false;
52 if (JSObject::cast(map->prototype())->map() != 52 if (JSObject::cast(map->prototype())->map() !=
53 isolate->native_context()->object_function_prototype_map()) { 53 isolate->native_context()->object_function_prototype_map()) {
54 return false; 54 return false;
55 } 55 }
56 // TODO(jkummerow): support dictionary properties? 56 // TODO(jkummerow): support dictionary properties?
57 if (map->is_dictionary_map()) return false; 57 if (map->is_dictionary_map()) return false;
58 Handle<DescriptorArray> descs = 58 Handle<DescriptorArray> descs = handle(map->instance_descriptors(), isolate);
59 Handle<DescriptorArray>(map->instance_descriptors());
60 for (int i = 0; i < map->NumberOfOwnDescriptors(); i++) { 59 for (int i = 0; i < map->NumberOfOwnDescriptors(); i++) {
61 PropertyDetails details = descs->GetDetails(i); 60 PropertyDetails details = descs->GetDetails(i);
62 Name* key = descs->GetKey(i); 61 Name* key = descs->GetKey(i);
63 Handle<Object> value; 62 Handle<Object> value;
64 if (details.location() == kField) { 63 if (details.location() == kField) {
65 if (details.kind() == kData) { 64 if (details.kind() == kData) {
66 value = JSObject::FastPropertyAt(Handle<JSObject>::cast(obj), 65 value = JSObject::FastPropertyAt(Handle<JSObject>::cast(obj),
67 details.representation(), 66 details.representation(),
68 FieldIndex::ForDescriptor(map, i)); 67 FieldIndex::ForDescriptor(*map, i));
69 } else { 68 } else {
70 DCHECK_EQ(kAccessor, details.kind()); 69 DCHECK_EQ(kAccessor, details.kind());
71 // Bail out to slow path. 70 // Bail out to slow path.
72 return false; 71 return false;
73 } 72 }
74 73
75 } else { 74 } else {
76 DCHECK_EQ(kDescriptor, details.location()); 75 DCHECK_EQ(kDescriptor, details.location());
77 if (details.kind() == kData) { 76 if (details.kind() == kData) {
78 value = handle(descs->GetValue(i), isolate); 77 value = handle(descs->GetValue(i), isolate);
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 // Desc.[[Enumerable]] to like.[[Enumerable]]. 335 // Desc.[[Enumerable]] to like.[[Enumerable]].
337 if (!desc->has_enumerable()) desc->set_enumerable(false); 336 if (!desc->has_enumerable()) desc->set_enumerable(false);
338 // 7. If Desc does not have a [[Configurable]] field, set 337 // 7. If Desc does not have a [[Configurable]] field, set
339 // Desc.[[Configurable]] to like.[[Configurable]]. 338 // Desc.[[Configurable]] to like.[[Configurable]].
340 if (!desc->has_configurable()) desc->set_configurable(false); 339 if (!desc->has_configurable()) desc->set_configurable(false);
341 // 8. Return Desc. 340 // 8. Return Desc.
342 } 341 }
343 342
344 } // namespace internal 343 } // namespace internal
345 } // namespace v8 344 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/regexp/regexp-macro-assembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698