Index: src/code-stubs.cc |
diff --git a/src/code-stubs.cc b/src/code-stubs.cc |
index 21d11a93d053210cbaea3fe80833f4783b855848..5775e633cac9b028d3f0002cf43840baa90acc3e 100644 |
--- a/src/code-stubs.cc |
+++ b/src/code-stubs.cc |
@@ -13,6 +13,7 @@ |
#include "src/ic/handler-compiler.h" |
#include "src/ic/ic.h" |
#include "src/macro-assembler.h" |
+#include "src/parser.h" |
namespace v8 { |
namespace internal { |
@@ -453,6 +454,35 @@ void CompareNilICStub::UpdateStatus(Handle<Object> object) { |
} |
+namespace { |
+ |
+Handle<JSFunction> GetFunction(Isolate* isolate, const char* name) { |
+ v8::ExtensionConfiguration no_extensions; |
+ Handle<Context> ctx = isolate->bootstrapper()->CreateEnvironment( |
+ MaybeHandle<JSGlobalProxy>(), v8::Handle<v8::ObjectTemplate>(), |
+ &no_extensions); |
+ Handle<JSBuiltinsObject> builtins = handle(ctx->builtins()); |
+ MaybeHandle<Object> fun = Object::GetProperty(isolate, builtins, 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() { |
+ Zone zone; |
+ // Build a "hybrid" CompilationInfo for a JSFunction/CodeStub pair. |
+ ParseInfo parse_info(&zone, GetFunction(isolate(), GetFunctionName())); |
+ CompilationInfo info(&parse_info); |
+ info.SetStub(this); |
+ return info.GenerateCodeStub(); |
+} |
+ |
+ |
template<class StateType> |
void HydrogenCodeStub::TraceTransition(StateType from, StateType to) { |
// Note: Although a no-op transition is semantically OK, it is hinting at a |