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

Side by Side Diff: src/interpreter/interpreter.cc

Issue 1372293005: [Interpreter] Support top-level code. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add Todos. Created 5 years, 2 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 unified diff | Download patch
« no previous file with comments | « src/interpreter/bytecode-generator.cc ('k') | src/objects.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/interpreter/interpreter.h" 5 #include "src/interpreter/interpreter.h"
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/compiler.h" 8 #include "src/compiler.h"
9 #include "src/compiler/interpreter-assembler.h" 9 #include "src/compiler/interpreter-assembler.h"
10 #include "src/factory.h" 10 #include "src/factory.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 Handle<Code> code = assembler.GenerateCode(); \ 52 Handle<Code> code = assembler.GenerateCode(); \
53 handler_table->set(static_cast<int>(Bytecode::k##Name), *code); \ 53 handler_table->set(static_cast<int>(Bytecode::k##Name), *code); \
54 } 54 }
55 BYTECODE_LIST(GENERATE_CODE) 55 BYTECODE_LIST(GENERATE_CODE)
56 #undef GENERATE_CODE 56 #undef GENERATE_CODE
57 } 57 }
58 } 58 }
59 59
60 60
61 bool Interpreter::MakeBytecode(CompilationInfo* info) { 61 bool Interpreter::MakeBytecode(CompilationInfo* info) {
62 Handle<SharedFunctionInfo> shared_info = info->shared_info();
63
64 BytecodeGenerator generator(info->isolate(), info->zone()); 62 BytecodeGenerator generator(info->isolate(), info->zone());
65 info->EnsureFeedbackVector(); 63 info->EnsureFeedbackVector();
66 Handle<BytecodeArray> bytecodes = generator.MakeBytecode(info); 64 Handle<BytecodeArray> bytecodes = generator.MakeBytecode(info);
67 if (FLAG_print_bytecode) { 65 if (FLAG_print_bytecode) {
68 bytecodes->Print(); 66 bytecodes->Print();
69 } 67 }
70 68
71 DCHECK(shared_info->function_data()->IsUndefined()); 69 info->SetBytecodeArray(bytecodes);
72 if (!shared_info->function_data()->IsUndefined()) {
73 return false;
74 }
75
76 shared_info->set_function_data(*bytecodes);
77 info->SetCode(info->isolate()->builtins()->InterpreterEntryTrampoline()); 70 info->SetCode(info->isolate()->builtins()->InterpreterEntryTrampoline());
78 return true; 71 return true;
79 } 72 }
80 73
81 74
82 bool Interpreter::IsInterpreterTableInitialized( 75 bool Interpreter::IsInterpreterTableInitialized(
83 Handle<FixedArray> handler_table) { 76 Handle<FixedArray> handler_table) {
84 DCHECK(handler_table->length() == static_cast<int>(Bytecode::kLast) + 1); 77 DCHECK(handler_table->length() == static_cast<int>(Bytecode::kLast) + 1);
85 return handler_table->get(0) != isolate_->heap()->undefined_value(); 78 return handler_table->get(0) != isolate_->heap()->undefined_value();
86 } 79 }
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 // 560 //
568 // Return the value in the accumulator. 561 // Return the value in the accumulator.
569 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) { 562 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) {
570 __ Return(); 563 __ Return();
571 } 564 }
572 565
573 566
574 } // namespace interpreter 567 } // namespace interpreter
575 } // namespace internal 568 } // namespace internal
576 } // namespace v8 569 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecode-generator.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698