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: src/compiler/code-generator.cc

Issue 562033003: [Turbofan] Insert nops for lazy bailout patching, fix translation of literals. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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/compiler/code-generator.h" 5 #include "src/compiler/code-generator.h"
6 6
7 #include "src/compiler/code-generator-impl.h" 7 #include "src/compiler/code-generator-impl.h"
8 #include "src/compiler/linkage.h" 8 #include "src/compiler/linkage.h"
9 #include "src/compiler/pipeline.h" 9 #include "src/compiler/pipeline.h"
10 10
11 namespace v8 { 11 namespace v8 {
12 namespace internal { 12 namespace internal {
13 namespace compiler { 13 namespace compiler {
14 14
15 CodeGenerator::CodeGenerator(InstructionSequence* code) 15 CodeGenerator::CodeGenerator(InstructionSequence* code)
16 : code_(code), 16 : code_(code),
17 current_block_(NULL), 17 current_block_(NULL),
18 current_source_position_(SourcePosition::Invalid()), 18 current_source_position_(SourcePosition::Invalid()),
19 masm_(code->zone()->isolate(), NULL, 0), 19 masm_(code->zone()->isolate(), NULL, 0),
20 resolver_(this), 20 resolver_(this),
21 safepoints_(code->zone()), 21 safepoints_(code->zone()),
22 deoptimization_states_(code->zone()), 22 deoptimization_states_(code->zone()),
23 deoptimization_literals_(code->zone()), 23 deoptimization_literals_(code->zone()),
24 translations_(code->zone()) {} 24 translations_(code->zone()),
25 last_lazy_deopt_pc_(0) {}
25 26
26 27
27 Handle<Code> CodeGenerator::GenerateCode() { 28 Handle<Code> CodeGenerator::GenerateCode() {
28 CompilationInfo* info = linkage()->info(); 29 CompilationInfo* info = linkage()->info();
29 30
30 // Emit a code line info recording start event. 31 // Emit a code line info recording start event.
31 PositionsRecorder* recorder = masm()->positions_recorder(); 32 PositionsRecorder* recorder = masm()->positions_recorder();
32 LOG_CODE_EVENT(isolate(), CodeStartLinePosInfoRecordEvent(recorder)); 33 LOG_CODE_EVENT(isolate(), CodeStartLinePosInfoRecordEvent(recorder));
33 34
34 // Place function entry hook if requested to do so. 35 // Place function entry hook if requested to do so.
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 236
236 RecordSafepoint( 237 RecordSafepoint(
237 instr->pointer_map(), Safepoint::kSimple, 0, 238 instr->pointer_map(), Safepoint::kSimple, 0,
238 needs_frame_state ? Safepoint::kLazyDeopt : Safepoint::kNoLazyDeopt); 239 needs_frame_state ? Safepoint::kLazyDeopt : Safepoint::kNoLazyDeopt);
239 240
240 if (flags & CallDescriptor::kNeedsNopAfterCall) { 241 if (flags & CallDescriptor::kNeedsNopAfterCall) {
241 AddNopForSmiCodeInlining(); 242 AddNopForSmiCodeInlining();
242 } 243 }
243 244
244 if (needs_frame_state) { 245 if (needs_frame_state) {
246 MarkLazyDeoptSite();
245 // If the frame state is present, it starts at argument 1 247 // If the frame state is present, it starts at argument 1
246 // (just after the code address). 248 // (just after the code address).
247 InstructionOperandConverter converter(this, instr); 249 InstructionOperandConverter converter(this, instr);
248 // Deoptimization info starts at argument 1 250 // Deoptimization info starts at argument 1
249 int frame_state_offset = 1; 251 int frame_state_offset = 1;
250 FrameStateDescriptor* descriptor = 252 FrameStateDescriptor* descriptor =
251 GetFrameStateDescriptor(instr, frame_state_offset); 253 GetFrameStateDescriptor(instr, frame_state_offset);
252 int pc_offset = masm()->pc_offset(); 254 int pc_offset = masm()->pc_offset();
253 int deopt_state_id = BuildTranslation(instr, pc_offset, frame_state_offset, 255 int deopt_state_id = BuildTranslation(instr, pc_offset, frame_state_offset,
254 descriptor->state_combine()); 256 descriptor->state_combine());
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 } else if (op->IsImmediate()) { 373 } else if (op->IsImmediate()) {
372 InstructionOperandConverter converter(this, instr); 374 InstructionOperandConverter converter(this, instr);
373 Constant constant = converter.ToConstant(op); 375 Constant constant = converter.ToConstant(op);
374 Handle<Object> constant_object; 376 Handle<Object> constant_object;
375 switch (constant.type()) { 377 switch (constant.type()) {
376 case Constant::kInt32: 378 case Constant::kInt32:
377 constant_object = 379 constant_object =
378 isolate()->factory()->NewNumberFromInt(constant.ToInt32()); 380 isolate()->factory()->NewNumberFromInt(constant.ToInt32());
379 break; 381 break;
380 case Constant::kFloat64: 382 case Constant::kFloat64:
381 constant_object = 383 constant_object = isolate()->factory()->NewNumber(constant.ToFloat64());
382 isolate()->factory()->NewHeapNumber(constant.ToFloat64());
383 break; 384 break;
384 case Constant::kHeapObject: 385 case Constant::kHeapObject:
385 constant_object = constant.ToHeapObject(); 386 constant_object = constant.ToHeapObject();
386 break; 387 break;
387 default: 388 default:
388 UNREACHABLE(); 389 UNREACHABLE();
389 } 390 }
390 int literal_id = DefineDeoptimizationLiteral(constant_object); 391 int literal_id = DefineDeoptimizationLiteral(constant_object);
391 translation->StoreLiteral(literal_id); 392 translation->StoreLiteral(literal_id);
392 } else { 393 } else {
393 UNREACHABLE(); 394 UNREACHABLE();
394 } 395 }
395 } 396 }
396 397
398
399 void CodeGenerator::MarkLazyDeoptSite() {
400 last_lazy_deopt_pc_ = masm()->pc_offset();
401 }
402
397 #if !V8_TURBOFAN_BACKEND 403 #if !V8_TURBOFAN_BACKEND
398 404
399 void CodeGenerator::AssembleArchInstruction(Instruction* instr) { 405 void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
400 UNIMPLEMENTED(); 406 UNIMPLEMENTED();
401 } 407 }
402 408
403 409
404 void CodeGenerator::AssembleArchBranch(Instruction* instr, 410 void CodeGenerator::AssembleArchBranch(Instruction* instr,
405 FlagsCondition condition) { 411 FlagsCondition condition) {
406 UNIMPLEMENTED(); 412 UNIMPLEMENTED();
(...skipping 29 matching lines...) Expand all
436 } 442 }
437 443
438 444
439 void CodeGenerator::AddNopForSmiCodeInlining() { UNIMPLEMENTED(); } 445 void CodeGenerator::AddNopForSmiCodeInlining() { UNIMPLEMENTED(); }
440 446
441 #endif // !V8_TURBOFAN_BACKEND 447 #endif // !V8_TURBOFAN_BACKEND
442 448
443 } // namespace compiler 449 } // namespace compiler
444 } // namespace internal 450 } // namespace internal
445 } // namespace v8 451 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698