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

Side by Side Diff: src/api-natives.cc

Issue 1407313004: Adds the possibility of setting a Code object as the callback of a FunctionTemplate. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Update. 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 unified diff | Download patch
« no previous file with comments | « src/api.cc ('k') | src/arm/builtins-arm.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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-natives.h" 5 #include "src/api-natives.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/isolate-inl.h" 8 #include "src/isolate-inl.h"
9 #include "src/lookup.h" 9 #include "src/lookup.h"
10 #include "src/messages.h" 10 #include "src/messages.h"
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 info->set_property_accessors(*list); 431 info->set_property_accessors(*list);
432 } 432 }
433 NeanderArray array(list); 433 NeanderArray array(list);
434 array.add(isolate, property); 434 array.add(isolate, property);
435 } 435 }
436 436
437 437
438 Handle<JSFunction> ApiNatives::CreateApiFunction( 438 Handle<JSFunction> ApiNatives::CreateApiFunction(
439 Isolate* isolate, Handle<FunctionTemplateInfo> obj, 439 Isolate* isolate, Handle<FunctionTemplateInfo> obj,
440 Handle<Object> prototype, ApiInstanceType instance_type) { 440 Handle<Object> prototype, ApiInstanceType instance_type) {
441 Handle<Code> code = isolate->builtins()->HandleApiCall(); 441 Handle<Code> code;
442 if (obj->call_code()->IsCallHandlerInfo() &&
443 CallHandlerInfo::cast(obj->call_code())->fast_handler()->IsCode()) {
444 code = isolate->builtins()->HandleFastApiCall();
445 } else {
446 code = isolate->builtins()->HandleApiCall();
447 }
442 Handle<Code> construct_stub = isolate->builtins()->JSConstructStubApi(); 448 Handle<Code> construct_stub = isolate->builtins()->JSConstructStubApi();
443 449
444 obj->set_instantiated(true); 450 obj->set_instantiated(true);
445 Handle<JSFunction> result; 451 Handle<JSFunction> result;
446 if (obj->remove_prototype()) { 452 if (obj->remove_prototype()) {
447 result = isolate->factory()->NewFunctionWithoutPrototype( 453 result = isolate->factory()->NewFunctionWithoutPrototype(
448 isolate->factory()->empty_string(), code); 454 isolate->factory()->empty_string(), code);
449 } else { 455 } else {
450 int internal_field_count = 0; 456 int internal_field_count = 0;
451 if (!obj->instance_template()->IsUndefined()) { 457 if (!obj->instance_template()->IsUndefined()) {
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 Handle<AccessorInfo> accessor(AccessorInfo::cast(array->get(i))); 614 Handle<AccessorInfo> accessor(AccessorInfo::cast(array->get(i)));
609 JSObject::SetAccessor(result, accessor).Assert(); 615 JSObject::SetAccessor(result, accessor).Assert();
610 } 616 }
611 617
612 DCHECK(result->shared()->IsApiFunction()); 618 DCHECK(result->shared()->IsApiFunction());
613 return result; 619 return result;
614 } 620 }
615 621
616 } // namespace internal 622 } // namespace internal
617 } // namespace v8 623 } // namespace v8
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/arm/builtins-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698