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

Side by Side Diff: src/isolate.cc

Issue 348313002: Introduce a PrototypeIterator template and use it all over the place (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebase Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « src/ic-inl.h ('k') | src/json-stringifier.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 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 <stdlib.h> 5 #include <stdlib.h>
6 6
7 #include "src/v8.h" 7 #include "src/v8.h"
8 8
9 #include "src/ast.h" 9 #include "src/ast.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after
994 994
995 bool Isolate::IsErrorObject(Handle<Object> obj) { 995 bool Isolate::IsErrorObject(Handle<Object> obj) {
996 if (!obj->IsJSObject()) return false; 996 if (!obj->IsJSObject()) return false;
997 997
998 Handle<String> error_key = 998 Handle<String> error_key =
999 factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR("$Error")); 999 factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR("$Error"));
1000 Handle<Object> error_constructor = Object::GetProperty( 1000 Handle<Object> error_constructor = Object::GetProperty(
1001 js_builtins_object(), error_key).ToHandleChecked(); 1001 js_builtins_object(), error_key).ToHandleChecked();
1002 1002
1003 DisallowHeapAllocation no_gc; 1003 DisallowHeapAllocation no_gc;
1004 for (Object* prototype = *obj; !prototype->IsNull(); 1004 for (PrototypeIterator<STORE_AS_POINTER, TYPE_BASED_WALK, END_AT_NULL_VALUE>
1005 prototype = prototype->GetPrototype(this)) { 1005 iter(this, *obj); !iter.IsAtEnd(); iter.Advance()) {
1006 if (!prototype->IsJSObject()) return false; 1006 if (!iter.GetCurrent()->IsJSObject()) return false;
1007 if (JSObject::cast(prototype)->map()->constructor() == 1007 if (JSObject::cast(iter.GetCurrent())->map()->constructor() ==
1008 *error_constructor) { 1008 *error_constructor) {
1009 return true; 1009 return true;
1010 } 1010 }
1011 } 1011 }
1012 return false; 1012 return false;
1013 } 1013 }
1014 1014
1015 static int fatal_exception_depth = 0; 1015 static int fatal_exception_depth = 0;
1016 1016
1017 void Isolate::DoThrow(Object* exception, MessageLocation* location) { 1017 void Isolate::DoThrow(Object* exception, MessageLocation* location) {
(...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after
2176 JSObject* initial_array_proto = JSObject::cast(*initial_array_prototype()); 2176 JSObject* initial_array_proto = JSObject::cast(*initial_array_prototype());
2177 2177
2178 // Check that the array prototype hasn't been altered WRT empty elements. 2178 // Check that the array prototype hasn't been altered WRT empty elements.
2179 if (root_array_map->prototype() != initial_array_proto) return false; 2179 if (root_array_map->prototype() != initial_array_proto) return false;
2180 if (initial_array_proto->elements() != heap()->empty_fixed_array()) { 2180 if (initial_array_proto->elements() != heap()->empty_fixed_array()) {
2181 return false; 2181 return false;
2182 } 2182 }
2183 2183
2184 // Check that the object prototype hasn't been altered WRT empty elements. 2184 // Check that the object prototype hasn't been altered WRT empty elements.
2185 JSObject* initial_object_proto = JSObject::cast(*initial_object_prototype()); 2185 JSObject* initial_object_proto = JSObject::cast(*initial_object_prototype());
2186 Object* root_array_map_proto = initial_array_proto->GetPrototype(); 2186 Object* root_array_map_proto = SAFE_GET_PROTOTYPE_FAST(initial_array_proto);
2187 if (root_array_map_proto != initial_object_proto) return false; 2187 if (root_array_map_proto != initial_object_proto) return false;
2188 if (initial_object_proto->elements() != heap()->empty_fixed_array()) { 2188 if (initial_object_proto->elements() != heap()->empty_fixed_array()) {
2189 return false; 2189 return false;
2190 } 2190 }
2191 2191
2192 return initial_object_proto->GetPrototype()->IsNull(); 2192 return SAFE_GET_PROTOTYPE_FAST(initial_object_proto)->IsNull();
2193 } 2193 }
2194 2194
2195 2195
2196 CodeStubInterfaceDescriptor* 2196 CodeStubInterfaceDescriptor*
2197 Isolate::code_stub_interface_descriptor(int index) { 2197 Isolate::code_stub_interface_descriptor(int index) {
2198 return code_stub_interface_descriptors_ + index; 2198 return code_stub_interface_descriptors_ + index;
2199 } 2199 }
2200 2200
2201 2201
2202 CallInterfaceDescriptor* 2202 CallInterfaceDescriptor*
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
2362 // The simulator uses a separate JS stack. 2362 // The simulator uses a separate JS stack.
2363 Address jssp_address = Simulator::current(isolate_)->get_sp(); 2363 Address jssp_address = Simulator::current(isolate_)->get_sp();
2364 uintptr_t jssp = reinterpret_cast<uintptr_t>(jssp_address); 2364 uintptr_t jssp = reinterpret_cast<uintptr_t>(jssp_address);
2365 if (jssp < stack_guard->real_jslimit()) return true; 2365 if (jssp < stack_guard->real_jslimit()) return true;
2366 #endif // USE_SIMULATOR 2366 #endif // USE_SIMULATOR
2367 return reinterpret_cast<uintptr_t>(this) < stack_guard->real_climit(); 2367 return reinterpret_cast<uintptr_t>(this) < stack_guard->real_climit();
2368 } 2368 }
2369 2369
2370 2370
2371 } } // namespace v8::internal 2371 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ic-inl.h ('k') | src/json-stringifier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698