| 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(jochen): Remove this after the setting is turned on globally. |
| 6 #define V8_IMMINENT_DEPRECATION_WARNINGS |
| 7 |
| 5 #include <utility> | 8 #include <utility> |
| 6 | 9 |
| 7 #include "src/v8.h" | 10 #include "src/v8.h" |
| 8 | 11 |
| 9 #include "src/compiler/pipeline.h" | 12 #include "src/compiler/pipeline.h" |
| 10 #include "src/execution.h" | 13 #include "src/execution.h" |
| 11 #include "src/handles.h" | 14 #include "src/handles.h" |
| 12 #include "src/interpreter/bytecode-array-builder.h" | 15 #include "src/interpreter/bytecode-array-builder.h" |
| 13 #include "src/interpreter/interpreter.h" | 16 #include "src/interpreter/interpreter.h" |
| 14 #include "src/parser.h" | 17 #include "src/parser.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 return BytecodeGraphCallable<A...>(isolate_, GetFunction()); | 83 return BytecodeGraphCallable<A...>(isolate_, GetFunction()); |
| 81 } | 84 } |
| 82 | 85 |
| 83 private: | 86 private: |
| 84 Isolate* isolate_; | 87 Isolate* isolate_; |
| 85 Zone* zone_; | 88 Zone* zone_; |
| 86 const char* script_; | 89 const char* script_; |
| 87 | 90 |
| 88 Handle<JSFunction> GetFunction() { | 91 Handle<JSFunction> GetFunction() { |
| 89 CompileRun(script_); | 92 CompileRun(script_); |
| 90 Local<Function> api_function = | 93 Local<Function> api_function = Local<Function>::Cast( |
| 91 Local<Function>::Cast(CcTest::global()->Get(v8_str(kFunctionName))); | 94 CcTest::global() |
| 95 ->Get(CcTest::isolate()->GetCurrentContext(), v8_str(kFunctionName)) |
| 96 .ToLocalChecked()); |
| 92 Handle<JSFunction> function = | 97 Handle<JSFunction> function = |
| 93 Handle<JSFunction>::cast(v8::Utils::OpenHandle(*api_function)); | 98 Handle<JSFunction>::cast(v8::Utils::OpenHandle(*api_function)); |
| 94 CHECK(function->shared()->HasBytecodeArray()); | 99 CHECK(function->shared()->HasBytecodeArray()); |
| 95 | 100 |
| 96 ParseInfo parse_info(zone_, function); | 101 ParseInfo parse_info(zone_, function); |
| 97 | 102 |
| 98 CompilationInfo compilation_info(&parse_info); | 103 CompilationInfo compilation_info(&parse_info); |
| 99 compilation_info.SetOptimizing(BailoutId::None(), Handle<Code>()); | 104 compilation_info.SetOptimizing(BailoutId::None(), Handle<Code>()); |
| 100 Parser parser(&parse_info); | 105 Parser parser(&parse_info); |
| 101 CHECK(parser.Parse(&parse_info)); | 106 CHECK(parser.Parse(&parse_info)); |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 snippets[i].code_snippet, kFunctionName); | 255 snippets[i].code_snippet, kFunctionName); |
| 251 | 256 |
| 252 BytecodeGraphTester tester(isolate, zone, script.start()); | 257 BytecodeGraphTester tester(isolate, zone, script.start()); |
| 253 auto callable = tester.GetCallable<Handle<Object>, Handle<Object>>(); | 258 auto callable = tester.GetCallable<Handle<Object>, Handle<Object>>(); |
| 254 Handle<Object> return_value = | 259 Handle<Object> return_value = |
| 255 callable(snippets[i].parameter(0), snippets[i].parameter(1)) | 260 callable(snippets[i].parameter(0), snippets[i].parameter(1)) |
| 256 .ToHandleChecked(); | 261 .ToHandleChecked(); |
| 257 CHECK(return_value->SameValue(*snippets[i].return_value())); | 262 CHECK(return_value->SameValue(*snippets[i].return_value())); |
| 258 } | 263 } |
| 259 } | 264 } |
| OLD | NEW |