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

Side by Side Diff: src/mips/lithium-codegen-mips.cc

Issue 587473003: Removed confusing defensive programming in GenerateJumpTable. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased 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/mips/lithium-codegen-mips.h ('k') | src/mips64/lithium-codegen-mips64.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved.7 1 // Copyright 2012 the V8 project authors. All rights reserved.7
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 bool LCodeGen::GenerateCode() { 69 bool LCodeGen::GenerateCode() {
70 LPhase phase("Z_Code generation", chunk()); 70 LPhase phase("Z_Code generation", chunk());
71 DCHECK(is_unused()); 71 DCHECK(is_unused());
72 status_ = GENERATING; 72 status_ = GENERATING;
73 73
74 // Open a frame scope to indicate that there is a frame on the stack. The 74 // Open a frame scope to indicate that there is a frame on the stack. The
75 // NONE indicates that the scope shouldn't actually generate code to set up 75 // NONE indicates that the scope shouldn't actually generate code to set up
76 // the frame (that is done in GeneratePrologue). 76 // the frame (that is done in GeneratePrologue).
77 FrameScope frame_scope(masm_, StackFrame::NONE); 77 FrameScope frame_scope(masm_, StackFrame::NONE);
78 78
79 return GeneratePrologue() && 79 return GeneratePrologue() && GenerateBody() && GenerateDeferredCode() &&
80 GenerateBody() && 80 GenerateJumpTable() && GenerateSafepointTable();
81 GenerateDeferredCode() &&
82 GenerateDeoptJumpTable() &&
83 GenerateSafepointTable();
84 } 81 }
85 82
86 83
87 void LCodeGen::FinishCode(Handle<Code> code) { 84 void LCodeGen::FinishCode(Handle<Code> code) {
88 DCHECK(is_done()); 85 DCHECK(is_done());
89 code->set_stack_slots(GetStackSlotCount()); 86 code->set_stack_slots(GetStackSlotCount());
90 code->set_safepoint_table_offset(safepoints_.GetCodeOffset()); 87 code->set_safepoint_table_offset(safepoints_.GetCodeOffset());
91 if (code->is_optimized_code()) RegisterWeakObjectsInOptimizedCode(code); 88 if (code->is_optimized_code()) RegisterWeakObjectsInOptimizedCode(code);
92 PopulateDeoptimizationData(code); 89 PopulateDeoptimizationData(code);
93 } 90 }
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 __ jmp(code->exit()); 316 __ jmp(code->exit());
320 } 317 }
321 } 318 }
322 // Deferred code is the last part of the instruction sequence. Mark 319 // Deferred code is the last part of the instruction sequence. Mark
323 // the generated code as done unless we bailed out. 320 // the generated code as done unless we bailed out.
324 if (!is_aborted()) status_ = DONE; 321 if (!is_aborted()) status_ = DONE;
325 return !is_aborted(); 322 return !is_aborted();
326 } 323 }
327 324
328 325
329 bool LCodeGen::GenerateDeoptJumpTable() { 326 bool LCodeGen::GenerateJumpTable() {
330 if (deopt_jump_table_.length() > 0) { 327 if (deopt_jump_table_.length() > 0) {
331 Label needs_frame, call_deopt_entry; 328 Label needs_frame, call_deopt_entry;
332 329
333 Comment(";;; -------------------- Jump table --------------------"); 330 Comment(";;; -------------------- Jump table --------------------");
334 Address base = deopt_jump_table_[0].address; 331 Address base = deopt_jump_table_[0].address;
335 332
336 Register entry_offset = t9; 333 Register entry_offset = t9;
337 334
338 int length = deopt_jump_table_.length(); 335 int length = deopt_jump_table_.length();
339 for (int i = 0; i < length; i++) { 336 for (int i = 0; i < length; i++) {
340 __ bind(&deopt_jump_table_[i].label); 337 __ bind(&deopt_jump_table_[i].label);
341 338
342 Deoptimizer::BailoutType type = deopt_jump_table_[i].bailout_type; 339 Deoptimizer::BailoutType type = deopt_jump_table_[i].bailout_type;
343 DCHECK(type == deopt_jump_table_[0].bailout_type); 340 DCHECK(type == deopt_jump_table_[0].bailout_type);
344 Address entry = deopt_jump_table_[i].address; 341 Address entry = deopt_jump_table_[i].address;
345 int id = Deoptimizer::GetDeoptimizationId(isolate(), entry, type); 342 int id = Deoptimizer::GetDeoptimizationId(isolate(), entry, type);
346 DCHECK(id != Deoptimizer::kNotDeoptimizationEntry); 343 DCHECK_NE(Deoptimizer::kNotDeoptimizationEntry, id);
347 Comment(";;; jump table entry %d: deoptimization bailout %d.", i, id); 344 Comment(";;; jump table entry %d: deoptimization bailout %d.", i, id);
348 345
349 // Second-level deopt table entries are contiguous and small, so instead 346 // Second-level deopt table entries are contiguous and small, so instead
350 // of loading the full, absolute address of each one, load an immediate 347 // of loading the full, absolute address of each one, load an immediate
351 // offset which will be added to the base address later. 348 // offset which will be added to the base address later.
352 __ li(entry_offset, Operand(entry - base)); 349 __ li(entry_offset, Operand(entry - base));
353 350
354 if (deopt_jump_table_[i].needs_frame) { 351 if (deopt_jump_table_[i].needs_frame) {
355 DCHECK(!info()->saves_caller_doubles()); 352 DCHECK(!info()->saves_caller_doubles());
356 if (needs_frame.is_bound()) { 353 if (needs_frame.is_bound()) {
(...skipping 5560 matching lines...) Expand 10 before | Expand all | Expand 10 after
5917 __ li(at, scope_info); 5914 __ li(at, scope_info);
5918 __ Push(at, ToRegister(instr->function())); 5915 __ Push(at, ToRegister(instr->function()));
5919 CallRuntime(Runtime::kPushBlockContext, 2, instr); 5916 CallRuntime(Runtime::kPushBlockContext, 2, instr);
5920 RecordSafepoint(Safepoint::kNoLazyDeopt); 5917 RecordSafepoint(Safepoint::kNoLazyDeopt);
5921 } 5918 }
5922 5919
5923 5920
5924 #undef __ 5921 #undef __
5925 5922
5926 } } // namespace v8::internal 5923 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mips/lithium-codegen-mips.h ('k') | src/mips64/lithium-codegen-mips64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698