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

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

Issue 21340002: Generate a custom OSR entrypoint for OSR compiles on all platforms, and transition to optimized cod… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Use FixedArray::OffsetAt and add comment to codegen. Created 7 years, 4 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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
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 13 matching lines...) Expand all
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #include "v8.h" 28 #include "v8.h"
29 29
30 #include "mips/lithium-codegen-mips.h" 30 #include "mips/lithium-codegen-mips.h"
31 #include "mips/lithium-gap-resolver-mips.h" 31 #include "mips/lithium-gap-resolver-mips.h"
32 #include "code-stubs.h" 32 #include "code-stubs.h"
33 #include "stub-cache.h" 33 #include "stub-cache.h"
34 #include "hydrogen-osr.h"
34 35
35 namespace v8 { 36 namespace v8 {
36 namespace internal { 37 namespace internal {
37 38
38 39
39 class SafepointGenerator : public CallWrapper { 40 class SafepointGenerator : public CallWrapper {
40 public: 41 public:
41 SafepointGenerator(LCodeGen* codegen, 42 SafepointGenerator(LCodeGen* codegen,
42 LPointerMap* pointers, 43 LPointerMap* pointers,
43 Safepoint::DeoptMode mode) 44 Safepoint::DeoptMode mode)
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 } 241 }
241 242
242 // Trace the call. 243 // Trace the call.
243 if (FLAG_trace && info()->IsOptimizing()) { 244 if (FLAG_trace && info()->IsOptimizing()) {
244 __ CallRuntime(Runtime::kTraceEnter, 0); 245 __ CallRuntime(Runtime::kTraceEnter, 0);
245 } 246 }
246 return !is_aborted(); 247 return !is_aborted();
247 } 248 }
248 249
249 250
251 void LCodeGen::GenerateOsrPrologue() {
252 // Generate the OSR entry prologue at the first unknown OSR value, or if there
253 // are none, at the OSR entrypoint instruction.
254 if (osr_pc_offset_ >= 0) return;
255
256 osr_pc_offset_ = masm()->pc_offset();
257
258 // Adjust the frame size, subsuming the unoptimized frame into the
259 // optimized frame.
260 int slots = GetStackSlotCount() - graph()->osr()->UnoptimizedFrameSlots();
261 ASSERT(slots >= 0);
262 __ Subu(sp, sp, Operand(slots * kPointerSize));
263 }
264
265
250 bool LCodeGen::GenerateBody() { 266 bool LCodeGen::GenerateBody() {
251 ASSERT(is_generating()); 267 ASSERT(is_generating());
252 bool emit_instructions = true; 268 bool emit_instructions = true;
253 for (current_instruction_ = 0; 269 for (current_instruction_ = 0;
254 !is_aborted() && current_instruction_ < instructions_->length(); 270 !is_aborted() && current_instruction_ < instructions_->length();
255 current_instruction_++) { 271 current_instruction_++) {
256 LInstruction* instr = instructions_->at(current_instruction_); 272 LInstruction* instr = instructions_->at(current_instruction_);
257 273
258 // Don't emit code for basic blocks with a replacement. 274 // Don't emit code for basic blocks with a replacement.
259 if (instr->IsLabel()) { 275 if (instr->IsLabel()) {
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after
1040 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); 1056 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
1041 break; 1057 break;
1042 } 1058 }
1043 default: 1059 default:
1044 UNREACHABLE(); 1060 UNREACHABLE();
1045 } 1061 }
1046 } 1062 }
1047 1063
1048 1064
1049 void LCodeGen::DoUnknownOSRValue(LUnknownOSRValue* instr) { 1065 void LCodeGen::DoUnknownOSRValue(LUnknownOSRValue* instr) {
1050 // Record the address of the first unknown OSR value as the place to enter. 1066 GenerateOsrPrologue();
1051 if (osr_pc_offset_ == -1) osr_pc_offset_ = masm()->pc_offset();
1052 } 1067 }
1053 1068
1054 1069
1055 void LCodeGen::DoModI(LModI* instr) { 1070 void LCodeGen::DoModI(LModI* instr) {
1056 HMod* hmod = instr->hydrogen(); 1071 HMod* hmod = instr->hydrogen();
1057 HValue* left = hmod->left(); 1072 HValue* left = hmod->left();
1058 HValue* right = hmod->right(); 1073 HValue* right = hmod->right();
1059 if (hmod->HasPowerOf2Divisor()) { 1074 if (hmod->HasPowerOf2Divisor()) {
1060 const Register scratch = scratch0(); 1075 const Register scratch = scratch0();
1061 const Register left_reg = ToRegister(instr->left()); 1076 const Register left_reg = ToRegister(instr->left());
(...skipping 4686 matching lines...) Expand 10 before | Expand all | Expand 10 after
5748 // This is a pseudo-instruction that ensures that the environment here is 5763 // This is a pseudo-instruction that ensures that the environment here is
5749 // properly registered for deoptimization and records the assembler's PC 5764 // properly registered for deoptimization and records the assembler's PC
5750 // offset. 5765 // offset.
5751 LEnvironment* environment = instr->environment(); 5766 LEnvironment* environment = instr->environment();
5752 5767
5753 // If the environment were already registered, we would have no way of 5768 // If the environment were already registered, we would have no way of
5754 // backpatching it with the spill slot operands. 5769 // backpatching it with the spill slot operands.
5755 ASSERT(!environment->HasBeenRegistered()); 5770 ASSERT(!environment->HasBeenRegistered());
5756 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); 5771 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt);
5757 5772
5758 // Normally we record the first unknown OSR value as the entrypoint to the OSR 5773 GenerateOsrPrologue();
5759 // code, but if there were none, record the entrypoint here.
5760 if (osr_pc_offset_ == -1) osr_pc_offset_ = masm()->pc_offset();
5761 } 5774 }
5762 5775
5763 5776
5764 void LCodeGen::DoForInPrepareMap(LForInPrepareMap* instr) { 5777 void LCodeGen::DoForInPrepareMap(LForInPrepareMap* instr) {
5765 Register result = ToRegister(instr->result()); 5778 Register result = ToRegister(instr->result());
5766 Register object = ToRegister(instr->object()); 5779 Register object = ToRegister(instr->object());
5767 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); 5780 __ LoadRoot(at, Heap::kUndefinedValueRootIndex);
5768 DeoptimizeIf(eq, instr->environment(), object, Operand(at)); 5781 DeoptimizeIf(eq, instr->environment(), object, Operand(at));
5769 5782
5770 Register null_value = t1; 5783 Register null_value = t1;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
5849 __ Subu(scratch, result, scratch); 5862 __ Subu(scratch, result, scratch);
5850 __ lw(result, FieldMemOperand(scratch, 5863 __ lw(result, FieldMemOperand(scratch,
5851 FixedArray::kHeaderSize - kPointerSize)); 5864 FixedArray::kHeaderSize - kPointerSize));
5852 __ bind(&done); 5865 __ bind(&done);
5853 } 5866 }
5854 5867
5855 5868
5856 #undef __ 5869 #undef __
5857 5870
5858 } } // namespace v8::internal 5871 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mips/lithium-codegen-mips.h ('k') | src/mips/lithium-mips.cc » ('j') | src/runtime.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698