OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 #include "test/cctest/cctest.h" | 6 #include "test/cctest/cctest.h" |
7 | 7 |
8 #include "src/compiler/code-generator.h" | 8 #include "src/compiler/code-generator.h" |
9 #include "src/compiler/common-operator.h" | 9 #include "src/compiler/common-operator.h" |
10 #include "src/compiler/graph.h" | 10 #include "src/compiler/graph.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 // Manually construct a schedule for the function below: | 128 // Manually construct a schedule for the function below: |
129 // function foo() { | 129 // function foo() { |
130 // deopt(); | 130 // deopt(); |
131 // } | 131 // } |
132 | 132 |
133 CSignature1<Object*, Object*> sig; | 133 CSignature1<Object*, Object*> sig; |
134 RawMachineAssembler m(graph, &sig); | 134 RawMachineAssembler m(graph, &sig); |
135 | 135 |
136 Handle<JSFunction> deopt_function = | 136 Handle<JSFunction> deopt_function = |
137 NewFunction("function deopt() { %DeoptimizeFunction(foo); }; deopt"); | 137 NewFunction("function deopt() { %DeoptimizeFunction(foo); }; deopt"); |
138 PrintableUnique<Object> deopt_fun_constant = | 138 Unique<Object> deopt_fun_constant = |
139 PrintableUnique<Object>::CreateUninitialized(zone(), deopt_function); | 139 Unique<Object>::CreateUninitialized(deopt_function); |
140 Node* deopt_fun_node = m.NewNode(common.HeapConstant(deopt_fun_constant)); | 140 Node* deopt_fun_node = m.NewNode(common.HeapConstant(deopt_fun_constant)); |
141 | 141 |
142 Handle<Context> context(deopt_function->context(), CcTest::i_isolate()); | 142 Handle<Context> context(deopt_function->context(), CcTest::i_isolate()); |
143 PrintableUnique<Object> context_constant = | 143 Unique<Object> context_constant = |
144 PrintableUnique<Object>::CreateUninitialized(zone(), context); | 144 Unique<Object>::CreateUninitialized(context); |
145 Node* context_node = m.NewNode(common.HeapConstant(context_constant)); | 145 Node* context_node = m.NewNode(common.HeapConstant(context_constant)); |
146 | 146 |
147 bailout_id = GetCallBailoutId(); | 147 bailout_id = GetCallBailoutId(); |
148 Node* parameters = m.NewNode(common.StateValues(1), m.UndefinedConstant()); | 148 Node* parameters = m.NewNode(common.StateValues(1), m.UndefinedConstant()); |
149 Node* locals = m.NewNode(common.StateValues(0)); | 149 Node* locals = m.NewNode(common.StateValues(0)); |
150 Node* stack = m.NewNode(common.StateValues(0)); | 150 Node* stack = m.NewNode(common.StateValues(0)); |
151 | 151 |
152 Node* state_node = | 152 Node* state_node = |
153 m.NewNode(common.FrameState(bailout_id, kIgnoreOutput), parameters, | 153 m.NewNode(common.FrameState(bailout_id, kIgnoreOutput), parameters, |
154 locals, stack, m.UndefinedConstant(), m.UndefinedConstant()); | 154 locals, stack, m.UndefinedConstant(), m.UndefinedConstant()); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 CommonOperatorBuilder common(zone()); | 237 CommonOperatorBuilder common(zone()); |
238 | 238 |
239 // Manually construct a schedule for the function below: | 239 // Manually construct a schedule for the function below: |
240 // function foo() { | 240 // function foo() { |
241 // %DeoptimizeFunction(foo); | 241 // %DeoptimizeFunction(foo); |
242 // } | 242 // } |
243 | 243 |
244 CSignature1<Object*, Object*> sig; | 244 CSignature1<Object*, Object*> sig; |
245 RawMachineAssembler m(graph, &sig); | 245 RawMachineAssembler m(graph, &sig); |
246 | 246 |
247 PrintableUnique<Object> this_fun_constant = | 247 Unique<Object> this_fun_constant = |
248 PrintableUnique<Object>::CreateUninitialized(zone(), function); | 248 Unique<Object>::CreateUninitialized(function); |
249 Node* this_fun_node = m.NewNode(common.HeapConstant(this_fun_constant)); | 249 Node* this_fun_node = m.NewNode(common.HeapConstant(this_fun_constant)); |
250 | 250 |
251 Handle<Context> context(function->context(), CcTest::i_isolate()); | 251 Handle<Context> context(function->context(), CcTest::i_isolate()); |
252 PrintableUnique<Object> context_constant = | 252 Unique<Object> context_constant = |
253 PrintableUnique<Object>::CreateUninitialized(zone(), context); | 253 Unique<Object>::CreateUninitialized(context); |
254 Node* context_node = m.NewNode(common.HeapConstant(context_constant)); | 254 Node* context_node = m.NewNode(common.HeapConstant(context_constant)); |
255 | 255 |
256 bailout_id = GetCallBailoutId(); | 256 bailout_id = GetCallBailoutId(); |
257 Node* parameters = m.NewNode(common.StateValues(1), m.UndefinedConstant()); | 257 Node* parameters = m.NewNode(common.StateValues(1), m.UndefinedConstant()); |
258 Node* locals = m.NewNode(common.StateValues(0)); | 258 Node* locals = m.NewNode(common.StateValues(0)); |
259 Node* stack = m.NewNode(common.StateValues(0)); | 259 Node* stack = m.NewNode(common.StateValues(0)); |
260 | 260 |
261 Node* state_node = | 261 Node* state_node = |
262 m.NewNode(common.FrameState(bailout_id, kIgnoreOutput), parameters, | 262 m.NewNode(common.FrameState(bailout_id, kIgnoreOutput), parameters, |
263 locals, stack, m.UndefinedConstant(), m.UndefinedConstant()); | 263 locals, stack, m.UndefinedConstant(), m.UndefinedConstant()); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 Handle<Object> result; | 304 Handle<Object> result; |
305 bool has_pending_exception = | 305 bool has_pending_exception = |
306 !Execution::Call(isolate, t.function, | 306 !Execution::Call(isolate, t.function, |
307 isolate->factory()->undefined_value(), 0, NULL, | 307 isolate->factory()->undefined_value(), 0, NULL, |
308 false).ToHandle(&result); | 308 false).ToHandle(&result); |
309 CHECK(!has_pending_exception); | 309 CHECK(!has_pending_exception); |
310 CHECK(result->SameValue(Smi::FromInt(42))); | 310 CHECK(result->SameValue(Smi::FromInt(42))); |
311 } | 311 } |
312 | 312 |
313 #endif | 313 #endif |
OLD | NEW |