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_X87 | 5 #if V8_TARGET_ARCH_X87 |
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 3122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3133 } | 3133 } |
3134 | 3134 |
3135 __ SmiUntag(value); | 3135 __ SmiUntag(value); |
3136 // No need to untag a smi for two-byte addressing. | 3136 // No need to untag a smi for two-byte addressing. |
3137 __ mov_w(FieldOperand(string, index, times_1, SeqTwoByteString::kHeaderSize), | 3137 __ mov_w(FieldOperand(string, index, times_1, SeqTwoByteString::kHeaderSize), |
3138 value); | 3138 value); |
3139 context()->Plug(string); | 3139 context()->Plug(string); |
3140 } | 3140 } |
3141 | 3141 |
3142 | 3142 |
3143 void FullCodeGenerator::EmitSetValueOf(CallRuntime* expr) { | |
3144 ZoneList<Expression*>* args = expr->arguments(); | |
3145 DCHECK(args->length() == 2); | |
3146 | |
3147 VisitForStackValue(args->at(0)); // Load the object. | |
3148 VisitForAccumulatorValue(args->at(1)); // Load the value. | |
3149 __ pop(ebx); // eax = value. ebx = object. | |
3150 | |
3151 Label done; | |
3152 // If the object is a smi, return the value. | |
3153 __ JumpIfSmi(ebx, &done, Label::kNear); | |
3154 | |
3155 // If the object is not a value type, return the value. | |
3156 __ CmpObjectType(ebx, JS_VALUE_TYPE, ecx); | |
3157 __ j(not_equal, &done, Label::kNear); | |
3158 | |
3159 // Store the value. | |
3160 __ mov(FieldOperand(ebx, JSValue::kValueOffset), eax); | |
3161 | |
3162 // Update the write barrier. Save the value as it will be | |
3163 // overwritten by the write barrier code and is needed afterward. | |
3164 __ mov(edx, eax); | |
3165 __ RecordWriteField(ebx, JSValue::kValueOffset, edx, ecx, kDontSaveFPRegs); | |
3166 | |
3167 __ bind(&done); | |
3168 context()->Plug(eax); | |
3169 } | |
3170 | |
3171 | |
3172 void FullCodeGenerator::EmitToInteger(CallRuntime* expr) { | 3143 void FullCodeGenerator::EmitToInteger(CallRuntime* expr) { |
3173 ZoneList<Expression*>* args = expr->arguments(); | 3144 ZoneList<Expression*>* args = expr->arguments(); |
3174 DCHECK_EQ(1, args->length()); | 3145 DCHECK_EQ(1, args->length()); |
3175 | 3146 |
3176 // Load the argument into eax and convert it. | 3147 // Load the argument into eax and convert it. |
3177 VisitForAccumulatorValue(args->at(0)); | 3148 VisitForAccumulatorValue(args->at(0)); |
3178 | 3149 |
3179 // Convert the object to an integer. | 3150 // Convert the object to an integer. |
3180 Label done_convert; | 3151 Label done_convert; |
3181 __ JumpIfSmi(eax, &done_convert, Label::kNear); | 3152 __ JumpIfSmi(eax, &done_convert, Label::kNear); |
(...skipping 1309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4491 Assembler::target_address_at(call_target_address, | 4462 Assembler::target_address_at(call_target_address, |
4492 unoptimized_code)); | 4463 unoptimized_code)); |
4493 return OSR_AFTER_STACK_CHECK; | 4464 return OSR_AFTER_STACK_CHECK; |
4494 } | 4465 } |
4495 | 4466 |
4496 | 4467 |
4497 } // namespace internal | 4468 } // namespace internal |
4498 } // namespace v8 | 4469 } // namespace v8 |
4499 | 4470 |
4500 #endif // V8_TARGET_ARCH_X87 | 4471 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |