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

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

Issue 1412103007: Version 4.8.135.3 (cherry-pick) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@4.8.135
Patch Set: Created 5 years, 2 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.cc ('k') | test/cctest/test-api.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"
8 #include "src/factory.h" 7 #include "src/factory.h"
9 #include "src/isolate-inl.h" 8 #include "src/isolate-inl.h"
10 #include "src/lookup.h" 9 #include "src/lookup.h"
11 #include "src/objects-inl.h" 10 #include "src/objects-inl.h"
12 11
13 namespace v8 { 12 namespace v8 {
14 namespace internal { 13 namespace internal {
15 14
16 // Helper function for ToPropertyDescriptor. Comments describe steps for 15 // Helper function for ToPropertyDescriptor. Comments describe steps for
17 // "enumerable", other properties are handled the same way. 16 // "enumerable", other properties are handled the same way.
(...skipping 19 matching lines...) Expand all
37 // objects: nothing on the prototype chain, just own fast data properties. 36 // objects: nothing on the prototype chain, just own fast data properties.
38 // Must not have observable side effects, because the slow path will restart 37 // Must not have observable side effects, because the slow path will restart
39 // the entire conversion! 38 // the entire conversion!
40 bool ToPropertyDescriptorFastPath(Isolate* isolate, Handle<Object> obj, 39 bool ToPropertyDescriptorFastPath(Isolate* isolate, Handle<Object> obj,
41 PropertyDescriptor* desc) { 40 PropertyDescriptor* desc) {
42 if (!obj->IsJSObject()) return false; 41 if (!obj->IsJSObject()) return false;
43 Map* map = Handle<JSObject>::cast(obj)->map(); 42 Map* map = Handle<JSObject>::cast(obj)->map();
44 if (map->instance_type() != JS_OBJECT_TYPE) return false; 43 if (map->instance_type() != JS_OBJECT_TYPE) return false;
45 if (map->is_access_check_needed()) return false; 44 if (map->is_access_check_needed()) return false;
46 if (map->prototype() != *isolate->initial_object_prototype()) return false; 45 if (map->prototype() != *isolate->initial_object_prototype()) return false;
47 // During bootstrapping, the object_function_prototype_map hasn't been
48 // set up yet.
49 if (isolate->bootstrapper()->IsActive()) return false;
50 if (JSObject::cast(map->prototype())->map() != 46 if (JSObject::cast(map->prototype())->map() !=
51 isolate->native_context()->object_function_prototype_map()) { 47 isolate->native_context()->object_function_prototype_map()) {
52 return false; 48 return false;
53 } 49 }
54 // TODO(jkummerow): support dictionary properties? 50 // TODO(jkummerow): support dictionary properties?
55 if (map->is_dictionary_map()) return false; 51 if (map->is_dictionary_map()) return false;
56 Handle<DescriptorArray> descs = 52 Handle<DescriptorArray> descs =
57 Handle<DescriptorArray>(map->instance_descriptors()); 53 Handle<DescriptorArray>(map->instance_descriptors());
58 for (int i = 0; i < map->NumberOfOwnDescriptors(); i++) { 54 for (int i = 0; i < map->NumberOfOwnDescriptors(); i++) {
59 PropertyDetails details = descs->GetDetails(i); 55 PropertyDetails details = descs->GetDetails(i);
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 // throw a TypeError exception. 203 // throw a TypeError exception.
208 if ((desc->has_get() || desc->has_set()) && 204 if ((desc->has_get() || desc->has_set()) &&
209 (desc->has_value() || desc->has_writable())) { 205 (desc->has_value() || desc->has_writable())) {
210 isolate->Throw(*isolate->factory()->NewTypeError( 206 isolate->Throw(*isolate->factory()->NewTypeError(
211 MessageTemplate::kValueAndAccessor, obj)); 207 MessageTemplate::kValueAndAccessor, obj));
212 return false; 208 return false;
213 } 209 }
214 } 210 }
215 } else { 211 } else {
216 DCHECK(obj->IsJSProxy()); 212 DCHECK(obj->IsJSProxy());
217 // Having an UNIMPLEMENTED() here would upset ClusterFuzz, because 213 UNIMPLEMENTED();
218 // --harmony-proxies makes it possible to reach this branch.
219 isolate->Throw(
220 *isolate->factory()->NewTypeError(MessageTemplate::kUnsupported));
221 return false;
222 } 214 }
223 // 23. Return desc. 215 // 23. Return desc.
224 return true; 216 return true;
225 } 217 }
226 218
227 219
228 } // namespace internal 220 } // namespace internal
229 } // namespace v8 221 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698