| OLD | NEW |
| 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/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/compiler.h" | 7 #include "src/compiler.h" |
| 8 #include "src/interpreter/bytecode-generator.h" | 8 #include "src/interpreter/bytecode-generator.h" |
| 9 #include "src/interpreter/interpreter.h" | 9 #include "src/interpreter/interpreter.h" |
| 10 #include "test/cctest/cctest.h" | 10 #include "test/cctest/cctest.h" |
| 11 | 11 |
| 12 namespace v8 { | 12 namespace v8 { |
| 13 namespace internal { | 13 namespace internal { |
| 14 namespace interpreter { | 14 namespace interpreter { |
| 15 | 15 |
| 16 class BytecodeGeneratorHelper { | 16 class BytecodeGeneratorHelper { |
| 17 public: | 17 public: |
| 18 const char* kFunctionName = "f"; | 18 const char* kFunctionName = "f"; |
| 19 | 19 |
| 20 const int kLastParamIndex = | 20 const int kLastParamIndex = |
| 21 -InterpreterFrameConstants::kLastParamFromRegisterPointer / kPointerSize; | 21 -InterpreterFrameConstants::kLastParamFromRegisterPointer / kPointerSize; |
| 22 | 22 |
| 23 BytecodeGeneratorHelper() { | 23 BytecodeGeneratorHelper() { |
| 24 i::FLAG_ignition = true; | 24 i::FLAG_ignition = true; |
| 25 i::FLAG_ignition_filter = kFunctionName; | 25 i::FLAG_ignition_filter = kFunctionName; |
| 26 i::FLAG_always_opt = false; |
| 26 CcTest::i_isolate()->interpreter()->Initialize(); | 27 CcTest::i_isolate()->interpreter()->Initialize(); |
| 27 } | 28 } |
| 28 | 29 |
| 29 | 30 |
| 30 Factory* factory() { return CcTest::i_isolate()->factory(); } | 31 Factory* factory() { return CcTest::i_isolate()->factory(); } |
| 31 | 32 |
| 32 | 33 |
| 33 Handle<BytecodeArray> MakeBytecode(const char* script, | 34 Handle<BytecodeArray> MakeBytecode(const char* script, |
| 34 const char* function_name) { | 35 const char* function_name) { |
| 35 CompileRun(script); | 36 CompileRun(script); |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 Handle<String> expected = helper.factory()->NewStringFromAsciiChecked( | 415 Handle<String> expected = helper.factory()->NewStringFromAsciiChecked( |
| 415 snippets[i].constants[j]); | 416 snippets[i].constants[j]); |
| 416 CHECK(String::cast(ba->constant_pool()->get(j))->Equals(*expected)); | 417 CHECK(String::cast(ba->constant_pool()->get(j))->Equals(*expected)); |
| 417 } | 418 } |
| 418 } | 419 } |
| 419 } | 420 } |
| 420 | 421 |
| 421 } // namespace interpreter | 422 } // namespace interpreter |
| 422 } // namespace internal | 423 } // namespace internal |
| 423 } // namespance v8 | 424 } // namespance v8 |
| OLD | NEW |