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 // TODO(rmcilroy): Remove this define after this flag is turned on globally |
| 6 #define V8_IMMINENT_DEPRECATION_WARNINGS |
| 7 |
5 #include "src/v8.h" | 8 #include "src/v8.h" |
6 | 9 |
7 #include "src/compiler.h" | 10 #include "src/compiler.h" |
8 #include "src/interpreter/bytecode-array-iterator.h" | 11 #include "src/interpreter/bytecode-array-iterator.h" |
9 #include "src/interpreter/bytecode-generator.h" | 12 #include "src/interpreter/bytecode-generator.h" |
10 #include "src/interpreter/interpreter.h" | 13 #include "src/interpreter/interpreter.h" |
11 #include "test/cctest/cctest.h" | 14 #include "test/cctest/cctest.h" |
12 #include "test/cctest/test-feedback-vector.h" | 15 #include "test/cctest/test-feedback-vector.h" |
13 | 16 |
14 namespace v8 { | 17 namespace v8 { |
(...skipping 25 matching lines...) Expand all Loading... |
40 i::FLAG_ignition_filter = "*"; | 43 i::FLAG_ignition_filter = "*"; |
41 Local<v8::Script> script = v8_compile(source); | 44 Local<v8::Script> script = v8_compile(source); |
42 i::FLAG_ignition_filter = old_ignition_filter; | 45 i::FLAG_ignition_filter = old_ignition_filter; |
43 i::Handle<i::JSFunction> js_function = v8::Utils::OpenHandle(*script); | 46 i::Handle<i::JSFunction> js_function = v8::Utils::OpenHandle(*script); |
44 return handle(js_function->shared()->bytecode_array(), CcTest::i_isolate()); | 47 return handle(js_function->shared()->bytecode_array(), CcTest::i_isolate()); |
45 } | 48 } |
46 | 49 |
47 Handle<BytecodeArray> MakeBytecode(const char* script, | 50 Handle<BytecodeArray> MakeBytecode(const char* script, |
48 const char* function_name) { | 51 const char* function_name) { |
49 CompileRun(script); | 52 CompileRun(script); |
50 Local<Function> function = | 53 v8::Local<v8::Context> context = |
51 Local<Function>::Cast(CcTest::global()->Get(v8_str(function_name))); | 54 v8::Isolate::GetCurrent()->GetCurrentContext(); |
| 55 Local<Function> function = Local<Function>::Cast( |
| 56 CcTest::global()->Get(context, v8_str(function_name)).ToLocalChecked()); |
52 i::Handle<i::JSFunction> js_function = | 57 i::Handle<i::JSFunction> js_function = |
53 i::Handle<i::JSFunction>::cast(v8::Utils::OpenHandle(*function)); | 58 i::Handle<i::JSFunction>::cast(v8::Utils::OpenHandle(*function)); |
54 return handle(js_function->shared()->bytecode_array(), CcTest::i_isolate()); | 59 return handle(js_function->shared()->bytecode_array(), CcTest::i_isolate()); |
55 } | 60 } |
56 | 61 |
57 Handle<BytecodeArray> MakeBytecodeForFunctionBody(const char* body) { | 62 Handle<BytecodeArray> MakeBytecodeForFunctionBody(const char* body) { |
58 ScopedVector<char> program(1024); | 63 ScopedVector<char> program(1024); |
59 SNPrintF(program, "function %s() { %s }\n%s();", kFunctionName, body, | 64 SNPrintF(program, "function %s() { %s }\n%s();", kFunctionName, body, |
60 kFunctionName); | 65 kFunctionName); |
61 return MakeBytecode(program.start(), kFunctionName); | 66 return MakeBytecode(program.start(), kFunctionName); |
(...skipping 4003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4065 for (size_t i = 0; i < arraysize(snippets); i++) { | 4070 for (size_t i = 0; i < arraysize(snippets); i++) { |
4066 Handle<BytecodeArray> bytecode_array = | 4071 Handle<BytecodeArray> bytecode_array = |
4067 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); | 4072 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); |
4068 CheckBytecodeArrayEqual(snippets[i], bytecode_array); | 4073 CheckBytecodeArrayEqual(snippets[i], bytecode_array); |
4069 } | 4074 } |
4070 } | 4075 } |
4071 | 4076 |
4072 } // namespace interpreter | 4077 } // namespace interpreter |
4073 } // namespace internal | 4078 } // namespace internal |
4074 } // namespace v8 | 4079 } // namespace v8 |
OLD | NEW |