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

Unified Diff: src/api.cc

Issue 1518703002: Re-re-land FastAccessorBuilder. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add test restrictions, as for test-api-fast-accessor-builder Created 5 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/DEPS ('k') | src/api-experimental.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 9544a0e32ccda78f9e5d949890ec07bcd121c29a..4cd54de0b848d59d9d2724729e46ecfd77a1506d 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -12,8 +12,10 @@
#include <limits>
#include <vector>
#include "include/v8-debug.h"
+#include "include/v8-experimental.h"
#include "include/v8-profiler.h"
#include "include/v8-testing.h"
+#include "src/api-experimental.h"
#include "src/api-natives.h"
#include "src/assert-scope.h"
#include "src/background-parsing-task.h"
@@ -999,7 +1001,7 @@ void FunctionTemplate::Inherit(v8::Local<FunctionTemplate> value) {
static Local<FunctionTemplate> FunctionTemplateNew(
i::Isolate* isolate, FunctionCallback callback,
- v8::Local<Value> fast_handler, v8::Local<Value> data,
+ experimental::FastAccessorBuilder* fast_handler, v8::Local<Value> data,
v8::Local<Signature> signature, int length, bool do_not_cache) {
i::Handle<i::Struct> struct_obj =
isolate->factory()->NewStruct(i::FUNCTION_TEMPLATE_INFO_TYPE);
@@ -1040,14 +1042,15 @@ Local<FunctionTemplate> FunctionTemplate::New(Isolate* isolate,
DCHECK(!i_isolate->serializer_enabled());
LOG_API(i_isolate, "FunctionTemplate::New");
ENTER_V8(i_isolate);
- return FunctionTemplateNew(i_isolate, callback, v8::Local<Value>(), data,
- signature, length, false);
+ return FunctionTemplateNew(i_isolate, callback, nullptr, data, signature,
+ length, false);
}
Local<FunctionTemplate> FunctionTemplate::NewWithFastHandler(
- Isolate* isolate, FunctionCallback callback, v8::Local<Value> fast_handler,
- v8::Local<Value> data, v8::Local<Signature> signature, int length) {
+ Isolate* isolate, FunctionCallback callback,
+ experimental::FastAccessorBuilder* fast_handler, v8::Local<Value> data,
+ v8::Local<Signature> signature, int length) {
// TODO(vogelheim): 'fast_handler' should have a more specific type than
// Local<Value>.
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
@@ -1077,9 +1080,9 @@ Local<AccessorSignature> AccessorSignature::New(
} while (false)
-void FunctionTemplate::SetCallHandler(FunctionCallback callback,
- v8::Local<Value> data,
- v8::Local<Value> fast_handler) {
+void FunctionTemplate::SetCallHandler(
+ FunctionCallback callback, v8::Local<Value> data,
+ experimental::FastAccessorBuilder* fast_handler) {
auto info = Utils::OpenHandle(this);
EnsureNotInstantiated(info, "v8::FunctionTemplate::SetCallHandler");
i::Isolate* isolate = info->GetIsolate();
@@ -1090,10 +1093,10 @@ void FunctionTemplate::SetCallHandler(FunctionCallback callback,
i::Handle<i::CallHandlerInfo> obj =
i::Handle<i::CallHandlerInfo>::cast(struct_obj);
SET_FIELD_WRAPPED(obj, set_callback, callback);
- if (!fast_handler.IsEmpty()) {
- i::Handle<i::Object> code = Utils::OpenHandle(*fast_handler);
- CHECK(code->IsCode());
- obj->set_fast_handler(*code);
+ i::MaybeHandle<i::Code> code =
+ i::experimental::BuildCodeFromFastAccessorBuilder(fast_handler);
+ if (!code.is_null()) {
+ obj->set_fast_handler(*code.ToHandleChecked());
}
if (data.IsEmpty()) {
data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate));
@@ -4368,7 +4371,7 @@ MaybeLocal<Function> Function::New(Local<Context> context,
i::Isolate* isolate = Utils::OpenHandle(*context)->GetIsolate();
LOG_API(isolate, "Function::New");
ENTER_V8(isolate);
- return FunctionTemplateNew(isolate, callback, Local<Value>(), data,
+ return FunctionTemplateNew(isolate, callback, nullptr, data,
Local<Signature>(), length, true)
->GetFunction(context);
}
« no previous file with comments | « src/DEPS ('k') | src/api-experimental.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698