Index: src/code-stubs.cc |
diff --git a/src/code-stubs.cc b/src/code-stubs.cc |
index 46d8342c50a8b2545a231740f920e27ef445753c..55147bd05bc0b5493f548e5ce6fcec8b8085de63 100644 |
--- a/src/code-stubs.cc |
+++ b/src/code-stubs.cc |
@@ -7,12 +7,16 @@ |
#include <sstream> |
#include "src/bootstrapper.h" |
+#include "src/compiler/pipeline.h" |
#include "src/cpu-profiler.h" |
#include "src/factory.h" |
#include "src/gdb-jit.h" |
#include "src/ic/handler-compiler.h" |
#include "src/ic/ic.h" |
#include "src/macro-assembler.h" |
+#include "src/parser.h" |
+ |
+using namespace v8::internal::compiler; |
namespace v8 { |
namespace internal { |
@@ -453,6 +457,38 @@ void CompareNilICStub::UpdateStatus(Handle<Object> object) { |
} |
+namespace { |
+ |
+static Handle<JSFunction> GetFunction(Isolate* isolate, const char* name) { |
Benedikt Meurer
2015/05/08 12:17:07
Nit: no static inside anonymous namespace.
danno
2015/05/08 15:28:01
Done.
|
+ 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; |
+} |
+}; |
Benedikt Meurer
2015/05/08 12:17:07
Remove ; and add empty line before, plus add // na
danno
2015/05/08 15:28:01
Done.
|
+ |
+ |
+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); |
+ // Run a "mini pipeline", extracted from compiler.cc. |
+ CHECK(Parser::ParseStatic(info.parse_info())); |
+ CHECK(Compiler::Analyze(info.parse_info())); |
+ return Pipeline(&info).GenerateCode(); |
+} |
+ |
+ |
template<class StateType> |
void HydrogenCodeStub::TraceTransition(StateType from, StateType to) { |
// Note: Although a no-op transition is semantically OK, it is hinting at a |