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

Side by Side Diff: src/api.cc

Issue 1369293003: Wrap JSFunction bindings in a helper object (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: comments. 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 | « no previous file | src/debug/debug.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 4427 matching lines...) Expand 10 before | Expand all | Expand 10 after
4438 i::Handle<i::Script> script(i::Script::cast(func->shared()->script())); 4438 i::Handle<i::Script> script(i::Script::cast(func->shared()->script()));
4439 return script->id(); 4439 return script->id();
4440 } 4440 }
4441 4441
4442 4442
4443 Local<v8::Value> Function::GetBoundFunction() const { 4443 Local<v8::Value> Function::GetBoundFunction() const {
4444 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); 4444 i::Handle<i::JSFunction> func = Utils::OpenHandle(this);
4445 if (!func->shared()->bound()) { 4445 if (!func->shared()->bound()) {
4446 return v8::Undefined(reinterpret_cast<v8::Isolate*>(func->GetIsolate())); 4446 return v8::Undefined(reinterpret_cast<v8::Isolate*>(func->GetIsolate()));
4447 } 4447 }
4448 i::Handle<i::FixedArray> bound_args = i::Handle<i::FixedArray>( 4448 i::Handle<i::BindingsArray> bound_args = i::Handle<i::BindingsArray>(
4449 i::FixedArray::cast(func->function_bindings())); 4449 i::BindingsArray::cast(func->function_bindings()));
4450 i::Handle<i::Object> original( 4450 i::Handle<i::Object> original(bound_args->bound_function(),
4451 bound_args->get(i::JSFunction::kBoundFunctionIndex), 4451 func->GetIsolate());
4452 func->GetIsolate());
4453 return Utils::ToLocal(i::Handle<i::JSFunction>::cast(original)); 4452 return Utils::ToLocal(i::Handle<i::JSFunction>::cast(original));
4454 } 4453 }
4455 4454
4456 4455
4457 int Name::GetIdentityHash() { 4456 int Name::GetIdentityHash() {
4458 auto self = Utils::OpenHandle(this); 4457 auto self = Utils::OpenHandle(this);
4459 return static_cast<int>(self->Hash()); 4458 return static_cast<int>(self->Hash());
4460 } 4459 }
4461 4460
4462 4461
(...skipping 3896 matching lines...) Expand 10 before | Expand all | Expand 10 after
8359 Address callback_address = 8358 Address callback_address =
8360 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 8359 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
8361 VMState<EXTERNAL> state(isolate); 8360 VMState<EXTERNAL> state(isolate);
8362 ExternalCallbackScope call_scope(isolate, callback_address); 8361 ExternalCallbackScope call_scope(isolate, callback_address);
8363 callback(info); 8362 callback(info);
8364 } 8363 }
8365 8364
8366 8365
8367 } // namespace internal 8366 } // namespace internal
8368 } // namespace v8 8367 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/debug/debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698