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

Side by Side Diff: src/arm/lithium-codegen-arm.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 "arm/lithium-codegen-arm.h" 30 #include "arm/lithium-codegen-arm.h"
31 #include "arm/lithium-gap-resolver-arm.h" 31 #include "arm/lithium-gap-resolver-arm.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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 } 247 }
247 248
248 // Trace the call. 249 // Trace the call.
249 if (FLAG_trace && info()->IsOptimizing()) { 250 if (FLAG_trace && info()->IsOptimizing()) {
250 __ CallRuntime(Runtime::kTraceEnter, 0); 251 __ CallRuntime(Runtime::kTraceEnter, 0);
251 } 252 }
252 return !is_aborted(); 253 return !is_aborted();
253 } 254 }
254 255
255 256
257 void LCodeGen::GenerateOsrPrologue() {
258 // Generate the OSR entry prologue at the first unknown OSR value, or if there
259 // are none, at the OSR entrypoint instruction.
260 if (osr_pc_offset_ >= 0) return;
261
262 osr_pc_offset_ = masm()->pc_offset();
263
264 // Adjust the frame size, subsuming the unoptimized frame into the
265 // optimized frame.
266 int slots = GetStackSlotCount() - graph()->osr()->UnoptimizedFrameSlots();
267 ASSERT(slots >= 0);
268 __ sub(sp, sp, Operand(slots * kPointerSize));
269 }
270
271
256 bool LCodeGen::GenerateBody() { 272 bool LCodeGen::GenerateBody() {
257 ASSERT(is_generating()); 273 ASSERT(is_generating());
258 bool emit_instructions = true; 274 bool emit_instructions = true;
259 for (current_instruction_ = 0; 275 for (current_instruction_ = 0;
260 !is_aborted() && current_instruction_ < instructions_->length(); 276 !is_aborted() && current_instruction_ < instructions_->length();
261 current_instruction_++) { 277 current_instruction_++) {
262 LInstruction* instr = instructions_->at(current_instruction_); 278 LInstruction* instr = instructions_->at(current_instruction_);
263 279
264 // Don't emit code for basic blocks with a replacement. 280 // Don't emit code for basic blocks with a replacement.
265 if (instr->IsLabel()) { 281 if (instr->IsLabel()) {
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after
1057 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); 1073 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
1058 break; 1074 break;
1059 } 1075 }
1060 default: 1076 default:
1061 UNREACHABLE(); 1077 UNREACHABLE();
1062 } 1078 }
1063 } 1079 }
1064 1080
1065 1081
1066 void LCodeGen::DoUnknownOSRValue(LUnknownOSRValue* instr) { 1082 void LCodeGen::DoUnknownOSRValue(LUnknownOSRValue* instr) {
1067 // Record the address of the first unknown OSR value as the place to enter. 1083 GenerateOsrPrologue();
1068 if (osr_pc_offset_ == -1) osr_pc_offset_ = masm()->pc_offset();
1069 } 1084 }
1070 1085
1071 1086
1072 void LCodeGen::DoModI(LModI* instr) { 1087 void LCodeGen::DoModI(LModI* instr) {
1073 HMod* hmod = instr->hydrogen(); 1088 HMod* hmod = instr->hydrogen();
1074 HValue* left = hmod->left(); 1089 HValue* left = hmod->left();
1075 HValue* right = hmod->right(); 1090 HValue* right = hmod->right();
1076 if (hmod->HasPowerOf2Divisor()) { 1091 if (hmod->HasPowerOf2Divisor()) {
1077 // TODO(svenpanne) We should really do the strength reduction on the 1092 // TODO(svenpanne) We should really do the strength reduction on the
1078 // Hydrogen level. 1093 // Hydrogen level.
(...skipping 4649 matching lines...) Expand 10 before | Expand all | Expand 10 after
5728 // This is a pseudo-instruction that ensures that the environment here is 5743 // This is a pseudo-instruction that ensures that the environment here is
5729 // properly registered for deoptimization and records the assembler's PC 5744 // properly registered for deoptimization and records the assembler's PC
5730 // offset. 5745 // offset.
5731 LEnvironment* environment = instr->environment(); 5746 LEnvironment* environment = instr->environment();
5732 5747
5733 // If the environment were already registered, we would have no way of 5748 // If the environment were already registered, we would have no way of
5734 // backpatching it with the spill slot operands. 5749 // backpatching it with the spill slot operands.
5735 ASSERT(!environment->HasBeenRegistered()); 5750 ASSERT(!environment->HasBeenRegistered());
5736 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); 5751 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt);
5737 5752
5738 // Normally we record the first unknown OSR value as the entrypoint to the OSR 5753 GenerateOsrPrologue();
5739 // code, but if there were none, record the entrypoint here.
5740 if (osr_pc_offset_ == -1) osr_pc_offset_ = masm()->pc_offset();
5741 } 5754 }
5742 5755
5743 5756
5744 void LCodeGen::DoForInPrepareMap(LForInPrepareMap* instr) { 5757 void LCodeGen::DoForInPrepareMap(LForInPrepareMap* instr) {
5745 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); 5758 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
5746 __ cmp(r0, ip); 5759 __ cmp(r0, ip);
5747 DeoptimizeIf(eq, instr->environment()); 5760 DeoptimizeIf(eq, instr->environment());
5748 5761
5749 Register null_value = r5; 5762 Register null_value = r5;
5750 __ LoadRoot(null_value, Heap::kNullValueRootIndex); 5763 __ LoadRoot(null_value, Heap::kNullValueRootIndex);
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
5831 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); 5844 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index));
5832 __ ldr(result, FieldMemOperand(scratch, 5845 __ ldr(result, FieldMemOperand(scratch,
5833 FixedArray::kHeaderSize - kPointerSize)); 5846 FixedArray::kHeaderSize - kPointerSize));
5834 __ bind(&done); 5847 __ bind(&done);
5835 } 5848 }
5836 5849
5837 5850
5838 #undef __ 5851 #undef __
5839 5852
5840 } } // namespace v8::internal 5853 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-codegen-arm.h ('k') | src/compiler.h » ('j') | src/runtime.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698