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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 | 194 |
195 TrivialDeoptCodegenTester t(&scope); | 195 TrivialDeoptCodegenTester t(&scope); |
196 t.GenerateCode(); | 196 t.GenerateCode(); |
197 | 197 |
198 DeoptimizationInputData* data = | 198 DeoptimizationInputData* data = |
199 DeoptimizationInputData::cast(t.result_code->deoptimization_data()); | 199 DeoptimizationInputData::cast(t.result_code->deoptimization_data()); |
200 | 200 |
201 Label* cont_label = t.code->GetLabel(t.cont_block); | 201 Label* cont_label = t.code->GetLabel(t.cont_block); |
202 Label* deopt_label = t.code->GetLabel(t.deopt_block); | 202 Label* deopt_label = t.code->GetLabel(t.deopt_block); |
203 | 203 |
204 // Check the patch table. It should patch the continuation address to the | 204 // Check the safepoint - it should contain an entry for the call |
205 // deoptimization block address. | 205 // with the right deoptimization address. |
206 CHECK_EQ(1, data->ReturnAddressPatchCount()); | 206 SafepointEntry entry = t.result_code->GetSafepointEntry( |
207 CHECK_EQ(cont_label->pos(), data->ReturnAddressPc(0)->value()); | 207 t.result_code->instruction_start() + cont_label->pos()); |
208 CHECK_EQ(deopt_label->pos(), data->PatchedAddressPc(0)->value()); | 208 CHECK(entry.is_valid()); |
| 209 CHECK_EQ(deopt_label->pos(), entry.deoptimization_pc()); |
209 | 210 |
210 // Check that we deoptimize to the right AST id. | 211 // Check that we deoptimize to the right AST id. |
211 CHECK_EQ(1, data->DeoptCount()); | 212 CHECK_EQ(1, data->DeoptCount()); |
212 CHECK_EQ(1, data->DeoptCount()); | 213 CHECK_EQ(1, data->DeoptCount()); |
213 CHECK_EQ(t.bailout_id.ToInt(), data->AstId(0).ToInt()); | 214 CHECK_EQ(t.bailout_id.ToInt(), data->AstId(0).ToInt()); |
214 } | 215 } |
215 | 216 |
216 | 217 |
217 TEST(TurboTrivialDeoptCodegenAndRun) { | 218 TEST(TurboTrivialDeoptCodegenAndRun) { |
218 HandleAndZoneScope scope; | 219 HandleAndZoneScope scope; |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 Handle<Object> result; | 338 Handle<Object> result; |
338 bool has_pending_exception = | 339 bool has_pending_exception = |
339 !Execution::Call(isolate, t.function, | 340 !Execution::Call(isolate, t.function, |
340 isolate->factory()->undefined_value(), 0, NULL, | 341 isolate->factory()->undefined_value(), 0, NULL, |
341 false).ToHandle(&result); | 342 false).ToHandle(&result); |
342 CHECK(!has_pending_exception); | 343 CHECK(!has_pending_exception); |
343 CHECK(result->SameValue(Smi::FromInt(42))); | 344 CHECK(result->SameValue(Smi::FromInt(42))); |
344 } | 345 } |
345 | 346 |
346 #endif | 347 #endif |
OLD | NEW |