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

Side by Side Diff: src/api.cc

Issue 390323002: Remove JSReceiver::GetPrototype and replace it with PrototypeIterator calls (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: updates Created 6 years, 5 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 3168 matching lines...) Expand 10 before | Expand all | Expand 10 after
3179 } 3179 }
3180 3180
3181 3181
3182 Local<Object> v8::Object::FindInstanceInPrototypeChain( 3182 Local<Object> v8::Object::FindInstanceInPrototypeChain(
3183 v8::Handle<FunctionTemplate> tmpl) { 3183 v8::Handle<FunctionTemplate> tmpl) {
3184 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 3184 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3185 ON_BAILOUT(isolate, 3185 ON_BAILOUT(isolate,
3186 "v8::Object::FindInstanceInPrototypeChain()", 3186 "v8::Object::FindInstanceInPrototypeChain()",
3187 return Local<v8::Object>()); 3187 return Local<v8::Object>());
3188 ENTER_V8(isolate); 3188 ENTER_V8(isolate);
3189 i::JSObject* object = *Utils::OpenHandle(this); 3189 i::PrototypeIterator iter(isolate, *Utils::OpenHandle(this),
3190 i::PrototypeIterator::START_AT_RECEIVER);
3190 i::FunctionTemplateInfo* tmpl_info = *Utils::OpenHandle(*tmpl); 3191 i::FunctionTemplateInfo* tmpl_info = *Utils::OpenHandle(*tmpl);
3191 while (!tmpl_info->IsTemplateFor(object)) { 3192 while (!tmpl_info->IsTemplateFor(iter.GetCurrent())) {
3192 i::Object* prototype = object->GetPrototype(); 3193 iter.Advance();
3193 if (!prototype->IsJSObject()) return Local<Object>(); 3194 if (iter.IsAtEnd()) {
3194 object = i::JSObject::cast(prototype); 3195 return Local<Object>();
3196 }
3195 } 3197 }
3196 return Utils::ToLocal(i::Handle<i::JSObject>(object)); 3198 return Utils::ToLocal(
3199 i::handle(i::JSObject::cast(iter.GetCurrent()), isolate));
3197 } 3200 }
3198 3201
3199 3202
3200 Local<Array> v8::Object::GetPropertyNames() { 3203 Local<Array> v8::Object::GetPropertyNames() {
3201 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 3204 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3202 ON_BAILOUT(isolate, "v8::Object::GetPropertyNames()", 3205 ON_BAILOUT(isolate, "v8::Object::GetPropertyNames()",
3203 return Local<v8::Array>()); 3206 return Local<v8::Array>());
3204 ENTER_V8(isolate); 3207 ENTER_V8(isolate);
3205 i::HandleScope scope(isolate); 3208 i::HandleScope scope(isolate);
3206 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 3209 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
(...skipping 4384 matching lines...) Expand 10 before | Expand all | Expand 10 after
7591 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7594 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7592 Address callback_address = 7595 Address callback_address =
7593 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7596 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7594 VMState<EXTERNAL> state(isolate); 7597 VMState<EXTERNAL> state(isolate);
7595 ExternalCallbackScope call_scope(isolate, callback_address); 7598 ExternalCallbackScope call_scope(isolate, callback_address);
7596 callback(info); 7599 callback(info);
7597 } 7600 }
7598 7601
7599 7602
7600 } } // namespace v8::internal 7603 } } // 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