| Index: src/compiler.cc
|
| diff --git a/src/compiler.cc b/src/compiler.cc
|
| index 3dfc4e3ddb70577ed5181b06e9b9ca5345a4a4b4..357f748432d5f2d35bdc6004be762cc9662049ba 100644
|
| --- a/src/compiler.cc
|
| +++ b/src/compiler.cc
|
| @@ -57,6 +57,7 @@ CompilationInfo::CompilationInfo(Handle<Script> script, Zone* zone)
|
| function_(NULL),
|
| scope_(NULL),
|
| global_scope_(NULL),
|
| + code_stub_(NULL),
|
| script_(script),
|
| extension_(NULL),
|
| pre_parse_data_(NULL),
|
| @@ -75,6 +76,7 @@ CompilationInfo::CompilationInfo(Handle<SharedFunctionInfo> shared_info,
|
| function_(NULL),
|
| scope_(NULL),
|
| global_scope_(NULL),
|
| + code_stub_(NULL),
|
| shared_info_(shared_info),
|
| script_(Handle<Script>(Script::cast(shared_info->script()))),
|
| extension_(NULL),
|
| @@ -93,6 +95,7 @@ CompilationInfo::CompilationInfo(Handle<JSFunction> closure, Zone* zone)
|
| function_(NULL),
|
| scope_(NULL),
|
| global_scope_(NULL),
|
| + code_stub_(NULL),
|
| closure_(closure),
|
| shared_info_(Handle<SharedFunctionInfo>(closure->shared())),
|
| script_(Handle<Script>(Script::cast(shared_info_->script()))),
|
| @@ -106,11 +109,56 @@ CompilationInfo::CompilationInfo(Handle<JSFunction> closure, Zone* zone)
|
| }
|
|
|
|
|
| +CompilationInfo::CompilationInfo(HydrogenCodeStub* stub,
|
| + Isolate* isolate, Zone* zone)
|
| + : isolate_(isolate),
|
| + flags_(LanguageModeField::encode(CLASSIC_MODE) |
|
| + IsLazy::encode(true)),
|
| + function_(NULL),
|
| + scope_(NULL),
|
| + global_scope_(NULL),
|
| + code_stub_(stub),
|
| + extension_(NULL),
|
| + pre_parse_data_(NULL),
|
| + osr_ast_id_(BailoutId::None()),
|
| + zone_(zone),
|
| + deferred_handles_(NULL) {
|
| + Initialize(STUB);
|
| +}
|
| +
|
| +
|
| CompilationInfo::~CompilationInfo() {
|
| delete deferred_handles_;
|
| }
|
|
|
|
|
| +int CompilationInfo::num_parameters() const {
|
| + if (IsStub()) {
|
| + return 0;
|
| + } else {
|
| + return scope()->num_parameters();
|
| + }
|
| +}
|
| +
|
| +
|
| +int CompilationInfo::num_heap_slots() const {
|
| + if (IsStub()) {
|
| + return 0;
|
| + } else {
|
| + return scope()->num_heap_slots();
|
| + }
|
| +}
|
| +
|
| +
|
| +Code::Flags CompilationInfo::flags() const {
|
| + if (IsStub()) {
|
| + return Code::ComputeFlags(Code::COMPILED_STUB);
|
| + } else {
|
| + return Code::ComputeFlags(Code::OPTIMIZED_FUNCTION);
|
| + }
|
| +}
|
| +
|
| +
|
| // Disable optimization for the rest of the compilation pipeline.
|
| void CompilationInfo::DisableOptimization() {
|
| bool is_optimizable_closure =
|
| @@ -321,13 +369,13 @@ OptimizingCompiler::Status OptimizingCompiler::CreateGraph() {
|
| if (FLAG_trace_hydrogen) {
|
| PrintF("-----------------------------------------------------------\n");
|
| PrintF("Compiling method %s using hydrogen\n", *name->ToCString());
|
| - HTracer::Instance()->TraceCompilation(info()->function());
|
| + HTracer::Instance()->TraceCompilation(info());
|
| }
|
| Handle<Context> native_context(
|
| info()->closure()->context()->native_context());
|
| oracle_ = new(info()->zone()) TypeFeedbackOracle(
|
| code, native_context, info()->isolate(), info()->zone());
|
| - graph_builder_ = new(info()->zone()) HGraphBuilder(info(), oracle_);
|
| + graph_builder_ = new(info()->zone()) HOptimizedGraphBuilder(info(), oracle_);
|
|
|
| Timer t(this, &time_taken_to_create_graph_);
|
| graph_ = graph_builder_->CreateGraph();
|
| @@ -380,7 +428,7 @@ OptimizingCompiler::Status OptimizingCompiler::GenerateAndInstallCode() {
|
| Timer timer(this, &time_taken_to_codegen_);
|
| ASSERT(chunk_ != NULL);
|
| ASSERT(graph_ != NULL);
|
| - Handle<Code> optimized_code = chunk_->Codegen();
|
| + Handle<Code> optimized_code = chunk_->Codegen(Code::OPTIMIZED_FUNCTION);
|
| if (optimized_code.is_null()) {
|
| info()->set_bailout_reason("code generation failed");
|
| return AbortOptimization();
|
|
|