Chromium Code Reviews| Index: src/code-stubs.cc |
| diff --git a/src/code-stubs.cc b/src/code-stubs.cc |
| index 46d8342c50a8b2545a231740f920e27ef445753c..c54ce365c54483319ac1505bf66fb7105ded41b2 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; |
|
Benedikt Meurer
2015/05/11 04:40:12
This violates the style guide. No toplevel using n
danno
2015/05/11 06:14:19
Done.
|
| namespace v8 { |
| namespace internal { |
| @@ -453,6 +457,38 @@ 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; |
| +} |
| +} |
|
Benedikt Meurer
2015/05/11 04:40:12
Use
} // namespace
instead of just
}
to make
danno
2015/05/11 06:14:19
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 |