| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 | 6 |
| 7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
| 8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
| 9 #include "src/hydrogen-osr.h" | 9 #include "src/hydrogen-osr.h" |
| 10 #include "src/ic/ic.h" | 10 #include "src/ic/ic.h" |
| (...skipping 2319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2330 __ li(at, Operand(factory()->the_hole_value())); | 2330 __ li(at, Operand(factory()->the_hole_value())); |
| 2331 EmitBranch(instr, eq, input_reg, Operand(at)); | 2331 EmitBranch(instr, eq, input_reg, Operand(at)); |
| 2332 return; | 2332 return; |
| 2333 } | 2333 } |
| 2334 | 2334 |
| 2335 DoubleRegister input_reg = ToDoubleRegister(instr->object()); | 2335 DoubleRegister input_reg = ToDoubleRegister(instr->object()); |
| 2336 EmitFalseBranchF(instr, eq, input_reg, input_reg); | 2336 EmitFalseBranchF(instr, eq, input_reg, input_reg); |
| 2337 | 2337 |
| 2338 Register scratch = scratch0(); | 2338 Register scratch = scratch0(); |
| 2339 __ FmoveHigh(scratch, input_reg); | 2339 __ FmoveHigh(scratch, input_reg); |
| 2340 __ dsll32(scratch, scratch, 0); // FmoveHigh (mfhc1) sign-extends. |
| 2341 __ dsrl32(scratch, scratch, 0); // Use only low 32-bits. |
| 2340 EmitBranch(instr, eq, scratch, Operand(kHoleNanUpper32)); | 2342 EmitBranch(instr, eq, scratch, Operand(kHoleNanUpper32)); |
| 2341 } | 2343 } |
| 2342 | 2344 |
| 2343 | 2345 |
| 2344 void LCodeGen::DoCompareMinusZeroAndBranch(LCompareMinusZeroAndBranch* instr) { | 2346 void LCodeGen::DoCompareMinusZeroAndBranch(LCompareMinusZeroAndBranch* instr) { |
| 2345 Representation rep = instr->hydrogen()->value()->representation(); | 2347 Representation rep = instr->hydrogen()->value()->representation(); |
| 2346 DCHECK(!rep.IsInteger32()); | 2348 DCHECK(!rep.IsInteger32()); |
| 2347 Register scratch = ToRegister(instr->temp()); | 2349 Register scratch = ToRegister(instr->temp()); |
| 2348 | 2350 |
| 2349 if (rep.IsDouble()) { | 2351 if (rep.IsDouble()) { |
| (...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3241 __ dsra32(at, key, 0); | 3243 __ dsra32(at, key, 0); |
| 3242 } else { | 3244 } else { |
| 3243 __ dsra(at, key, -shift_size); | 3245 __ dsra(at, key, -shift_size); |
| 3244 } | 3246 } |
| 3245 __ Daddu(scratch, scratch, at); | 3247 __ Daddu(scratch, scratch, at); |
| 3246 } | 3248 } |
| 3247 | 3249 |
| 3248 __ ldc1(result, MemOperand(scratch)); | 3250 __ ldc1(result, MemOperand(scratch)); |
| 3249 | 3251 |
| 3250 if (instr->hydrogen()->RequiresHoleCheck()) { | 3252 if (instr->hydrogen()->RequiresHoleCheck()) { |
| 3251 __ lw(scratch, MemOperand(scratch, sizeof(kHoleNanLower32))); | 3253 __ lwu(scratch, MemOperand(scratch, sizeof(kHoleNanLower32))); |
| 3252 DeoptimizeIf(eq, instr, "hole", scratch, Operand(kHoleNanUpper32)); | 3254 DeoptimizeIf(eq, instr, "hole", scratch, Operand(kHoleNanUpper32)); |
| 3253 } | 3255 } |
| 3254 } | 3256 } |
| 3255 | 3257 |
| 3256 | 3258 |
| 3257 void LCodeGen::DoLoadKeyedFixedArray(LLoadKeyed* instr) { | 3259 void LCodeGen::DoLoadKeyedFixedArray(LLoadKeyed* instr) { |
| 3258 HLoadKeyed* hinstr = instr->hydrogen(); | 3260 HLoadKeyed* hinstr = instr->hydrogen(); |
| 3259 Register elements = ToRegister(instr->elements()); | 3261 Register elements = ToRegister(instr->elements()); |
| 3260 Register result = ToRegister(instr->result()); | 3262 Register result = ToRegister(instr->result()); |
| 3261 Register scratch = scratch0(); | 3263 Register scratch = scratch0(); |
| (...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4182 } | 4184 } |
| 4183 } | 4185 } |
| 4184 | 4186 |
| 4185 | 4187 |
| 4186 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { | 4188 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { |
| 4187 Representation representation = instr->representation(); | 4189 Representation representation = instr->representation(); |
| 4188 | 4190 |
| 4189 Register object = ToRegister(instr->object()); | 4191 Register object = ToRegister(instr->object()); |
| 4190 Register scratch2 = scratch1(); | 4192 Register scratch2 = scratch1(); |
| 4191 Register scratch1 = scratch0(); | 4193 Register scratch1 = scratch0(); |
| 4194 |
| 4192 HObjectAccess access = instr->hydrogen()->access(); | 4195 HObjectAccess access = instr->hydrogen()->access(); |
| 4193 int offset = access.offset(); | 4196 int offset = access.offset(); |
| 4194 if (access.IsExternalMemory()) { | 4197 if (access.IsExternalMemory()) { |
| 4195 Register value = ToRegister(instr->value()); | 4198 Register value = ToRegister(instr->value()); |
| 4196 MemOperand operand = MemOperand(object, offset); | 4199 MemOperand operand = MemOperand(object, offset); |
| 4197 __ Store(value, operand, representation); | 4200 __ Store(value, operand, representation); |
| 4198 return; | 4201 return; |
| 4199 } | 4202 } |
| 4200 | 4203 |
| 4201 __ AssertNotSmi(object); | 4204 __ AssertNotSmi(object); |
| 4202 | 4205 |
| 4203 DCHECK(!representation.IsSmi() || | 4206 DCHECK(!representation.IsSmi() || |
| 4204 !instr->value()->IsConstantOperand() || | 4207 !instr->value()->IsConstantOperand() || |
| 4205 IsSmi(LConstantOperand::cast(instr->value()))); | 4208 IsSmi(LConstantOperand::cast(instr->value()))); |
| 4206 if (representation.IsDouble()) { | 4209 if (!FLAG_unbox_double_fields && representation.IsDouble()) { |
| 4207 DCHECK(access.IsInobject()); | 4210 DCHECK(access.IsInobject()); |
| 4208 DCHECK(!instr->hydrogen()->has_transition()); | 4211 DCHECK(!instr->hydrogen()->has_transition()); |
| 4209 DCHECK(!instr->hydrogen()->NeedsWriteBarrier()); | 4212 DCHECK(!instr->hydrogen()->NeedsWriteBarrier()); |
| 4210 DoubleRegister value = ToDoubleRegister(instr->value()); | 4213 DoubleRegister value = ToDoubleRegister(instr->value()); |
| 4211 __ sdc1(value, FieldMemOperand(object, offset)); | 4214 __ sdc1(value, FieldMemOperand(object, offset)); |
| 4212 return; | 4215 return; |
| 4213 } | 4216 } |
| 4214 | 4217 |
| 4215 if (instr->hydrogen()->has_transition()) { | 4218 if (instr->hydrogen()->has_transition()) { |
| 4216 Handle<Map> transition = instr->hydrogen()->transition_map(); | 4219 Handle<Map> transition = instr->hydrogen()->transition_map(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 4227 kSaveFPRegs); | 4230 kSaveFPRegs); |
| 4228 } | 4231 } |
| 4229 } | 4232 } |
| 4230 | 4233 |
| 4231 // Do the store. | 4234 // Do the store. |
| 4232 Register destination = object; | 4235 Register destination = object; |
| 4233 if (!access.IsInobject()) { | 4236 if (!access.IsInobject()) { |
| 4234 destination = scratch1; | 4237 destination = scratch1; |
| 4235 __ ld(destination, FieldMemOperand(object, JSObject::kPropertiesOffset)); | 4238 __ ld(destination, FieldMemOperand(object, JSObject::kPropertiesOffset)); |
| 4236 } | 4239 } |
| 4237 Register value = ToRegister(instr->value()); | 4240 |
| 4238 if (representation.IsSmi() && SmiValuesAre32Bits() && | 4241 if (representation.IsSmi() && SmiValuesAre32Bits() && |
| 4239 instr->hydrogen()->value()->representation().IsInteger32()) { | 4242 instr->hydrogen()->value()->representation().IsInteger32()) { |
| 4240 DCHECK(instr->hydrogen()->store_mode() == STORE_TO_INITIALIZED_ENTRY); | 4243 DCHECK(instr->hydrogen()->store_mode() == STORE_TO_INITIALIZED_ENTRY); |
| 4241 if (FLAG_debug_code) { | 4244 if (FLAG_debug_code) { |
| 4242 __ Load(scratch2, FieldMemOperand(destination, offset), representation); | 4245 __ Load(scratch2, FieldMemOperand(destination, offset), representation); |
| 4243 __ AssertSmi(scratch2); | 4246 __ AssertSmi(scratch2); |
| 4244 } | 4247 } |
| 4245 | |
| 4246 // Store int value directly to upper half of the smi. | 4248 // Store int value directly to upper half of the smi. |
| 4247 offset += kPointerSize / 2; | 4249 offset += kPointerSize / 2; |
| 4248 representation = Representation::Integer32(); | 4250 representation = Representation::Integer32(); |
| 4249 } | 4251 } |
| 4252 MemOperand operand = FieldMemOperand(destination, offset); |
| 4250 | 4253 |
| 4251 MemOperand operand = FieldMemOperand(destination, offset); | 4254 if (FLAG_unbox_double_fields && representation.IsDouble()) { |
| 4252 __ Store(value, operand, representation); | 4255 DCHECK(access.IsInobject()); |
| 4256 DoubleRegister value = ToDoubleRegister(instr->value()); |
| 4257 __ sdc1(value, operand); |
| 4258 } else { |
| 4259 DCHECK(instr->value()->IsRegister()); |
| 4260 Register value = ToRegister(instr->value()); |
| 4261 __ Store(value, operand, representation); |
| 4262 } |
| 4263 |
| 4253 if (instr->hydrogen()->NeedsWriteBarrier()) { | 4264 if (instr->hydrogen()->NeedsWriteBarrier()) { |
| 4254 // Update the write barrier for the object for in-object properties. | 4265 // Update the write barrier for the object for in-object properties. |
| 4266 Register value = ToRegister(instr->value()); |
| 4255 __ RecordWriteField(destination, | 4267 __ RecordWriteField(destination, |
| 4256 offset, | 4268 offset, |
| 4257 value, | 4269 value, |
| 4258 scratch2, | 4270 scratch2, |
| 4259 GetRAState(), | 4271 GetRAState(), |
| 4260 kSaveFPRegs, | 4272 kSaveFPRegs, |
| 4261 EMIT_REMEMBERED_SET, | 4273 EMIT_REMEMBERED_SET, |
| 4262 instr->hydrogen()->SmiCheckForWriteBarrier(), | 4274 instr->hydrogen()->SmiCheckForWriteBarrier(), |
| 4263 instr->hydrogen()->PointersToHereCheckForValue()); | 4275 instr->hydrogen()->PointersToHereCheckForValue()); |
| 4264 } | 4276 } |
| (...skipping 1741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6006 __ li(at, scope_info); | 6018 __ li(at, scope_info); |
| 6007 __ Push(at, ToRegister(instr->function())); | 6019 __ Push(at, ToRegister(instr->function())); |
| 6008 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6020 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
| 6009 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6021 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 6010 } | 6022 } |
| 6011 | 6023 |
| 6012 | 6024 |
| 6013 #undef __ | 6025 #undef __ |
| 6014 | 6026 |
| 6015 } } // namespace v8::internal | 6027 } } // namespace v8::internal |
| OLD | NEW |