Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: test/cctest/compiler/test-codegen-deopt.cc

Issue 542613002: Fix deoptimization of context. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebase Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/deoptimizer.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 Unique<Object> deopt_fun_constant = 138 Unique<Object> deopt_fun_constant =
139 Unique<Object>::CreateUninitialized(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> caller_context(function->context(), CcTest::i_isolate());
143 Unique<Object> context_constant = 143 Unique<Object> caller_context_constant =
144 Unique<Object>::CreateUninitialized(context); 144 Unique<Object>::CreateUninitialized(caller_context);
145 Node* context_node = m.NewNode(common.HeapConstant(context_constant)); 145 Node* caller_context_node =
146 m.NewNode(common.HeapConstant(caller_context_constant));
146 147
147 bailout_id = GetCallBailoutId(); 148 bailout_id = GetCallBailoutId();
148 Node* parameters = m.NewNode(common.StateValues(1), m.UndefinedConstant()); 149 Node* parameters = m.NewNode(common.StateValues(1), m.UndefinedConstant());
149 Node* locals = m.NewNode(common.StateValues(0)); 150 Node* locals = m.NewNode(common.StateValues(0));
150 Node* stack = m.NewNode(common.StateValues(0)); 151 Node* stack = m.NewNode(common.StateValues(0));
151 152
152 Node* state_node = 153 Node* state_node =
153 m.NewNode(common.FrameState(bailout_id, kIgnoreOutput), parameters, 154 m.NewNode(common.FrameState(bailout_id, kIgnoreOutput), parameters,
154 locals, stack, m.UndefinedConstant(), m.UndefinedConstant()); 155 locals, stack, caller_context_node, m.UndefinedConstant());
156
157 Handle<Context> context(deopt_function->context(), CcTest::i_isolate());
158 Unique<Object> context_constant =
159 Unique<Object>::CreateUninitialized(context);
160 Node* context_node = m.NewNode(common.HeapConstant(context_constant));
155 161
156 m.CallJS0(deopt_fun_node, m.UndefinedConstant(), context_node, state_node); 162 m.CallJS0(deopt_fun_node, m.UndefinedConstant(), context_node, state_node);
157 163
158 m.Return(m.UndefinedConstant()); 164 m.Return(m.UndefinedConstant());
159 165
160 // Schedule the graph: 166 // Schedule the graph:
161 Schedule* schedule = m.Export(); 167 Schedule* schedule = m.Export();
162 168
163 return schedule; 169 return schedule;
164 } 170 }
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 Unique<Object>::CreateUninitialized(context); 259 Unique<Object>::CreateUninitialized(context);
254 Node* context_node = m.NewNode(common.HeapConstant(context_constant)); 260 Node* context_node = m.NewNode(common.HeapConstant(context_constant));
255 261
256 bailout_id = GetCallBailoutId(); 262 bailout_id = GetCallBailoutId();
257 Node* parameters = m.NewNode(common.StateValues(1), m.UndefinedConstant()); 263 Node* parameters = m.NewNode(common.StateValues(1), m.UndefinedConstant());
258 Node* locals = m.NewNode(common.StateValues(0)); 264 Node* locals = m.NewNode(common.StateValues(0));
259 Node* stack = m.NewNode(common.StateValues(0)); 265 Node* stack = m.NewNode(common.StateValues(0));
260 266
261 Node* state_node = 267 Node* state_node =
262 m.NewNode(common.FrameState(bailout_id, kIgnoreOutput), parameters, 268 m.NewNode(common.FrameState(bailout_id, kIgnoreOutput), parameters,
263 locals, stack, m.UndefinedConstant(), m.UndefinedConstant()); 269 locals, stack, context_node, m.UndefinedConstant());
264 270
265 m.CallRuntime1(Runtime::kDeoptimizeFunction, this_fun_node, context_node, 271 m.CallRuntime1(Runtime::kDeoptimizeFunction, this_fun_node, context_node,
266 state_node); 272 state_node);
267 273
268 m.Return(m.UndefinedConstant()); 274 m.Return(m.UndefinedConstant());
269 275
270 // Schedule the graph: 276 // Schedule the graph:
271 Schedule* schedule = m.Export(); 277 Schedule* schedule = m.Export();
272 278
273 return schedule; 279 return schedule;
(...skipping 30 matching lines...) Expand all
304 Handle<Object> result; 310 Handle<Object> result;
305 bool has_pending_exception = 311 bool has_pending_exception =
306 !Execution::Call(isolate, t.function, 312 !Execution::Call(isolate, t.function,
307 isolate->factory()->undefined_value(), 0, NULL, 313 isolate->factory()->undefined_value(), 0, NULL,
308 false).ToHandle(&result); 314 false).ToHandle(&result);
309 CHECK(!has_pending_exception); 315 CHECK(!has_pending_exception);
310 CHECK(result->SameValue(Smi::FromInt(42))); 316 CHECK(result->SameValue(Smi::FromInt(42)));
311 } 317 }
312 318
313 #endif 319 #endif
OLDNEW
« no previous file with comments | « src/deoptimizer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698