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

Side by Side Diff: src/api.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/accessors.cc ('k') | src/builtins.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 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/api.h" 5 #include "src/api.h"
6 6
7 #include <string.h> // For memcpy, strlen. 7 #include <string.h> // For memcpy, strlen.
8 #ifdef V8_USE_ADDRESS_SANITIZER 8 #ifdef V8_USE_ADDRESS_SANITIZER
9 #include <sanitizer/asan_interface.h> 9 #include <sanitizer/asan_interface.h>
10 #endif // V8_USE_ADDRESS_SANITIZER 10 #endif // V8_USE_ADDRESS_SANITIZER
(...skipping 19 matching lines...) Expand all
30 #include "src/messages.h" 30 #include "src/messages.h"
31 #ifdef COMPRESS_STARTUP_DATA_BZ2 31 #ifdef COMPRESS_STARTUP_DATA_BZ2
32 #include "src/natives.h" 32 #include "src/natives.h"
33 #endif 33 #endif
34 #include "src/parser.h" 34 #include "src/parser.h"
35 #include "src/platform.h" 35 #include "src/platform.h"
36 #include "src/platform/time.h" 36 #include "src/platform/time.h"
37 #include "src/profile-generator-inl.h" 37 #include "src/profile-generator-inl.h"
38 #include "src/property.h" 38 #include "src/property.h"
39 #include "src/property-details.h" 39 #include "src/property-details.h"
40 #include "src/prototype-iterator.h"
40 #include "src/runtime.h" 41 #include "src/runtime.h"
41 #include "src/runtime-profiler.h" 42 #include "src/runtime-profiler.h"
42 #include "src/scanner-character-streams.h" 43 #include "src/scanner-character-streams.h"
43 #include "src/simulator.h" 44 #include "src/simulator.h"
44 #include "src/snapshot.h" 45 #include "src/snapshot.h"
45 #include "src/unicode-inl.h" 46 #include "src/unicode-inl.h"
46 #include "src/utils/random-number-generator.h" 47 #include "src/utils/random-number-generator.h"
47 #include "src/v8threads.h" 48 #include "src/v8threads.h"
48 #include "src/version.h" 49 #include "src/version.h"
49 #include "src/vm-state-inl.h" 50 #include "src/vm-state-inl.h"
(...skipping 3107 matching lines...) Expand 10 before | Expand all | Expand 10 after
3157 if (result == ABSENT) return static_cast<PropertyAttribute>(NONE); 3158 if (result == ABSENT) return static_cast<PropertyAttribute>(NONE);
3158 return static_cast<PropertyAttribute>(result); 3159 return static_cast<PropertyAttribute>(result);
3159 } 3160 }
3160 3161
3161 3162
3162 Local<Value> v8::Object::GetPrototype() { 3163 Local<Value> v8::Object::GetPrototype() {
3163 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 3164 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3164 ON_BAILOUT(isolate, "v8::Object::GetPrototype()", return Local<v8::Value>()); 3165 ON_BAILOUT(isolate, "v8::Object::GetPrototype()", return Local<v8::Value>());
3165 ENTER_V8(isolate); 3166 ENTER_V8(isolate);
3166 i::Handle<i::Object> self = Utils::OpenHandle(this); 3167 i::Handle<i::Object> self = Utils::OpenHandle(this);
3167 i::Handle<i::Object> result(self->GetPrototype(isolate), isolate); 3168 i::Handle<i::Object> result(SAFE_GET_PROTOTYPE(isolate, *self), isolate);
3168 return Utils::ToLocal(result); 3169 return Utils::ToLocal(result);
3169 } 3170 }
3170 3171
3171 3172
3172 bool v8::Object::SetPrototype(Handle<Value> value) { 3173 bool v8::Object::SetPrototype(Handle<Value> value) {
3173 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 3174 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3174 ON_BAILOUT(isolate, "v8::Object::SetPrototype()", return false); 3175 ON_BAILOUT(isolate, "v8::Object::SetPrototype()", return false);
3175 ENTER_V8(isolate); 3176 ENTER_V8(isolate);
3176 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 3177 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
3177 i::Handle<i::Object> value_obj = Utils::OpenHandle(*value); 3178 i::Handle<i::Object> value_obj = Utils::OpenHandle(*value);
(...skipping 11 matching lines...) Expand all
3189 3190
3190 Local<Object> v8::Object::FindInstanceInPrototypeChain( 3191 Local<Object> v8::Object::FindInstanceInPrototypeChain(
3191 v8::Handle<FunctionTemplate> tmpl) { 3192 v8::Handle<FunctionTemplate> tmpl) {
3192 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 3193 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3193 ON_BAILOUT(isolate, 3194 ON_BAILOUT(isolate,
3194 "v8::Object::FindInstanceInPrototypeChain()", 3195 "v8::Object::FindInstanceInPrototypeChain()",
3195 return Local<v8::Object>()); 3196 return Local<v8::Object>());
3196 ENTER_V8(isolate); 3197 ENTER_V8(isolate);
3197 i::JSObject* object = *Utils::OpenHandle(this); 3198 i::JSObject* object = *Utils::OpenHandle(this);
3198 i::FunctionTemplateInfo* tmpl_info = *Utils::OpenHandle(*tmpl); 3199 i::FunctionTemplateInfo* tmpl_info = *Utils::OpenHandle(*tmpl);
3199 while (!tmpl_info->IsTemplateFor(object)) { 3200 for (i::PrototypeIterator<i::STORE_AS_POINTER, i::MAP_BASED_WALK,
3200 i::Object* prototype = object->GetPrototype(); 3201 i::END_AT_NULL_VALUE> iter(object);
3201 if (!prototype->IsJSObject()) return Local<Object>(); 3202 !iter.IsAtEnd(); iter.Advance()) {
3202 object = i::JSObject::cast(prototype); 3203 if (tmpl_info->IsTemplateFor(iter.GetCurrent())) {
3204 return Utils::ToLocal(
3205 i::Handle<i::JSObject>(i::JSObject::cast(iter.GetCurrent())));
3206 }
3203 } 3207 }
3204 return Utils::ToLocal(i::Handle<i::JSObject>(object)); 3208 return Local<Object>();
3205 } 3209 }
3206 3210
3207 3211
3208 Local<Array> v8::Object::GetPropertyNames() { 3212 Local<Array> v8::Object::GetPropertyNames() {
3209 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 3213 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3210 ON_BAILOUT(isolate, "v8::Object::GetPropertyNames()", 3214 ON_BAILOUT(isolate, "v8::Object::GetPropertyNames()",
3211 return Local<v8::Array>()); 3215 return Local<v8::Array>());
3212 ENTER_V8(isolate); 3216 ENTER_V8(isolate);
3213 i::HandleScope scope(isolate); 3217 i::HandleScope scope(isolate);
3214 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 3218 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
(...skipping 4400 matching lines...) Expand 10 before | Expand all | Expand 10 after
7615 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7619 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7616 Address callback_address = 7620 Address callback_address =
7617 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7621 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7618 VMState<EXTERNAL> state(isolate); 7622 VMState<EXTERNAL> state(isolate);
7619 ExternalCallbackScope call_scope(isolate, callback_address); 7623 ExternalCallbackScope call_scope(isolate, callback_address);
7620 callback(info); 7624 callback(info);
7621 } 7625 }
7622 7626
7623 7627
7624 } } // namespace v8::internal 7628 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/accessors.cc ('k') | src/builtins.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698