| 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 #if V8_TARGET_ARCH_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
| 6 | 6 |
| 7 #include "src/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
| 8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
| 9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 3138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3149 } | 3149 } |
| 3150 | 3150 |
| 3151 __ SmiUntag(value); | 3151 __ SmiUntag(value); |
| 3152 // No need to untag a smi for two-byte addressing. | 3152 // No need to untag a smi for two-byte addressing. |
| 3153 __ mov_w(FieldOperand(string, index, times_1, SeqTwoByteString::kHeaderSize), | 3153 __ mov_w(FieldOperand(string, index, times_1, SeqTwoByteString::kHeaderSize), |
| 3154 value); | 3154 value); |
| 3155 context()->Plug(string); | 3155 context()->Plug(string); |
| 3156 } | 3156 } |
| 3157 | 3157 |
| 3158 | 3158 |
| 3159 void FullCodeGenerator::EmitSetValueOf(CallRuntime* expr) { | |
| 3160 ZoneList<Expression*>* args = expr->arguments(); | |
| 3161 DCHECK(args->length() == 2); | |
| 3162 | |
| 3163 VisitForStackValue(args->at(0)); // Load the object. | |
| 3164 VisitForAccumulatorValue(args->at(1)); // Load the value. | |
| 3165 __ pop(ebx); // eax = value. ebx = object. | |
| 3166 | |
| 3167 Label done; | |
| 3168 // If the object is a smi, return the value. | |
| 3169 __ JumpIfSmi(ebx, &done, Label::kNear); | |
| 3170 | |
| 3171 // If the object is not a value type, return the value. | |
| 3172 __ CmpObjectType(ebx, JS_VALUE_TYPE, ecx); | |
| 3173 __ j(not_equal, &done, Label::kNear); | |
| 3174 | |
| 3175 // Store the value. | |
| 3176 __ mov(FieldOperand(ebx, JSValue::kValueOffset), eax); | |
| 3177 | |
| 3178 // Update the write barrier. Save the value as it will be | |
| 3179 // overwritten by the write barrier code and is needed afterward. | |
| 3180 __ mov(edx, eax); | |
| 3181 __ RecordWriteField(ebx, JSValue::kValueOffset, edx, ecx, kDontSaveFPRegs); | |
| 3182 | |
| 3183 __ bind(&done); | |
| 3184 context()->Plug(eax); | |
| 3185 } | |
| 3186 | |
| 3187 | |
| 3188 void FullCodeGenerator::EmitToInteger(CallRuntime* expr) { | 3159 void FullCodeGenerator::EmitToInteger(CallRuntime* expr) { |
| 3189 ZoneList<Expression*>* args = expr->arguments(); | 3160 ZoneList<Expression*>* args = expr->arguments(); |
| 3190 DCHECK_EQ(1, args->length()); | 3161 DCHECK_EQ(1, args->length()); |
| 3191 | 3162 |
| 3192 // Load the argument into eax and convert it. | 3163 // Load the argument into eax and convert it. |
| 3193 VisitForAccumulatorValue(args->at(0)); | 3164 VisitForAccumulatorValue(args->at(0)); |
| 3194 | 3165 |
| 3195 // Convert the object to an integer. | 3166 // Convert the object to an integer. |
| 3196 Label done_convert; | 3167 Label done_convert; |
| 3197 __ JumpIfSmi(eax, &done_convert, Label::kNear); | 3168 __ JumpIfSmi(eax, &done_convert, Label::kNear); |
| (...skipping 1309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4507 Assembler::target_address_at(call_target_address, | 4478 Assembler::target_address_at(call_target_address, |
| 4508 unoptimized_code)); | 4479 unoptimized_code)); |
| 4509 return OSR_AFTER_STACK_CHECK; | 4480 return OSR_AFTER_STACK_CHECK; |
| 4510 } | 4481 } |
| 4511 | 4482 |
| 4512 | 4483 |
| 4513 } // namespace internal | 4484 } // namespace internal |
| 4514 } // namespace v8 | 4485 } // namespace v8 |
| 4515 | 4486 |
| 4516 #endif // V8_TARGET_ARCH_IA32 | 4487 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |