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

Unified Diff: src/code-stubs.cc

Issue 1150263002: JavaScript stubs have access to their calling convention and minor key now. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/code-stubs.h ('k') | src/runtime.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/code-stubs.cc
diff --git a/src/code-stubs.cc b/src/code-stubs.cc
index a1437ece39bf287cc370142336cbcd4c87f35040..2d8b56b1cf98a3f7d95a995a77949326d00bd56c 100644
--- a/src/code-stubs.cc
+++ b/src/code-stubs.cc
@@ -477,17 +477,31 @@ Handle<JSFunction> GetFunction(Isolate* isolate, const char* name) {
Handle<JSFunction> function = Handle<JSFunction>::cast(fun.ToHandleChecked());
DCHECK(!function->IsUndefined() &&
"JavaScript implementation of stub not found");
- // Just to make sure nobody calls this...
- function->set_code(isolate->builtins()->builtin(Builtins::kIllegal));
return function;
}
} // namespace
Handle<Code> TurboFanCodeStub::GenerateCode() {
+ // Get the outer ("stub generator") function.
+ const char* name = CodeStub::MajorName(MajorKey(), false);
+ Handle<JSFunction> outer = GetFunction(isolate(), name);
+ DCHECK_EQ(2, outer->shared()->length());
+
+ // Invoke the outer function to get the stub itself.
+ Factory* factory = isolate()->factory();
+ Handle<Object> call_conv = factory->InternalizeUtf8String(name);
+ Handle<Object> minor_key = factory->NewNumber(MinorKey());
+ Handle<Object> args[] = {call_conv, minor_key};
+ MaybeHandle<Object> result = Execution::Call(
+ isolate(), outer, factory->undefined_value(), 2, args, false);
+ Handle<JSFunction> inner = Handle<JSFunction>::cast(result.ToHandleChecked());
+ // Just to make sure nobody calls this...
+ inner->set_code(isolate()->builtins()->builtin(Builtins::kIllegal));
+
Zone zone;
// Build a "hybrid" CompilationInfo for a JSFunction/CodeStub pair.
- ParseInfo parse_info(&zone, GetFunction(isolate(), GetFunctionName()));
+ ParseInfo parse_info(&zone, inner);
CompilationInfo info(&parse_info);
info.SetStub(this);
return info.GenerateCodeStub();
« no previous file with comments | « src/code-stubs.h ('k') | src/runtime.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698