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-array-iterator.h" | 8 #include "src/interpreter/bytecode-array-iterator.h" |
9 #include "src/interpreter/bytecode-generator.h" | 9 #include "src/interpreter/bytecode-generator.h" |
10 #include "src/interpreter/interpreter.h" | 10 #include "src/interpreter/interpreter.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 i::Handle<i::JSFunction> js_function = v8::Utils::OpenHandle(*script); | 44 i::Handle<i::JSFunction> js_function = v8::Utils::OpenHandle(*script); |
45 return handle(js_function->shared()->bytecode_array(), CcTest::i_isolate()); | 45 return handle(js_function->shared()->bytecode_array(), CcTest::i_isolate()); |
46 } | 46 } |
47 | 47 |
48 | 48 |
49 Handle<BytecodeArray> MakeBytecode(const char* script, | 49 Handle<BytecodeArray> MakeBytecode(const char* script, |
50 const char* function_name) { | 50 const char* function_name) { |
51 CompileRun(script); | 51 CompileRun(script); |
52 Local<Function> function = | 52 Local<Function> function = |
53 Local<Function>::Cast(CcTest::global()->Get(v8_str(function_name))); | 53 Local<Function>::Cast(CcTest::global()->Get(v8_str(function_name))); |
54 i::Handle<i::JSFunction> js_function = v8::Utils::OpenHandle(*function); | 54 i::Handle<i::JSFunction> js_function = |
| 55 i::Handle<i::JSFunction>::cast(v8::Utils::OpenHandle(*function)); |
55 return handle(js_function->shared()->bytecode_array(), CcTest::i_isolate()); | 56 return handle(js_function->shared()->bytecode_array(), CcTest::i_isolate()); |
56 } | 57 } |
57 | 58 |
58 | 59 |
59 Handle<BytecodeArray> MakeBytecodeForFunctionBody(const char* body) { | 60 Handle<BytecodeArray> MakeBytecodeForFunctionBody(const char* body) { |
60 ScopedVector<char> program(1024); | 61 ScopedVector<char> program(1024); |
61 SNPrintF(program, "function %s() { %s }\n%s();", kFunctionName, body, | 62 SNPrintF(program, "function %s() { %s }\n%s();", kFunctionName, body, |
62 kFunctionName); | 63 kFunctionName); |
63 return MakeBytecode(program.start(), kFunctionName); | 64 return MakeBytecode(program.start(), kFunctionName); |
64 } | 65 } |
(...skipping 3423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3488 for (size_t i = 0; i < arraysize(snippets); i++) { | 3489 for (size_t i = 0; i < arraysize(snippets); i++) { |
3489 Handle<BytecodeArray> bytecode_array = | 3490 Handle<BytecodeArray> bytecode_array = |
3490 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); | 3491 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); |
3491 CheckBytecodeArrayEqual(snippets[i], bytecode_array); | 3492 CheckBytecodeArrayEqual(snippets[i], bytecode_array); |
3492 } | 3493 } |
3493 } | 3494 } |
3494 | 3495 |
3495 } // namespace interpreter | 3496 } // namespace interpreter |
3496 } // namespace internal | 3497 } // namespace internal |
3497 } // namespace v8 | 3498 } // namespace v8 |
OLD | NEW |