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_X64 | 5 #if V8_TARGET_ARCH_X64 |
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 3121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3132 static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag; | 3132 static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag; |
3133 __ EmitSeqStringSetCharCheck(string, index, value, two_byte_seq_type); | 3133 __ EmitSeqStringSetCharCheck(string, index, value, two_byte_seq_type); |
3134 } | 3134 } |
3135 | 3135 |
3136 __ movw(FieldOperand(string, index, times_2, SeqTwoByteString::kHeaderSize), | 3136 __ movw(FieldOperand(string, index, times_2, SeqTwoByteString::kHeaderSize), |
3137 value); | 3137 value); |
3138 context()->Plug(rax); | 3138 context()->Plug(rax); |
3139 } | 3139 } |
3140 | 3140 |
3141 | 3141 |
3142 void FullCodeGenerator::EmitSetValueOf(CallRuntime* expr) { | |
3143 ZoneList<Expression*>* args = expr->arguments(); | |
3144 DCHECK(args->length() == 2); | |
3145 | |
3146 VisitForStackValue(args->at(0)); // Load the object. | |
3147 VisitForAccumulatorValue(args->at(1)); // Load the value. | |
3148 __ Pop(rbx); // rax = value. rbx = object. | |
3149 | |
3150 Label done; | |
3151 // If the object is a smi, return the value. | |
3152 __ JumpIfSmi(rbx, &done); | |
3153 | |
3154 // If the object is not a value type, return the value. | |
3155 __ CmpObjectType(rbx, JS_VALUE_TYPE, rcx); | |
3156 __ j(not_equal, &done); | |
3157 | |
3158 // Store the value. | |
3159 __ movp(FieldOperand(rbx, JSValue::kValueOffset), rax); | |
3160 // Update the write barrier. Save the value as it will be | |
3161 // overwritten by the write barrier code and is needed afterward. | |
3162 __ movp(rdx, rax); | |
3163 __ RecordWriteField(rbx, JSValue::kValueOffset, rdx, rcx, kDontSaveFPRegs); | |
3164 | |
3165 __ bind(&done); | |
3166 context()->Plug(rax); | |
3167 } | |
3168 | |
3169 | |
3170 void FullCodeGenerator::EmitToInteger(CallRuntime* expr) { | 3142 void FullCodeGenerator::EmitToInteger(CallRuntime* expr) { |
3171 ZoneList<Expression*>* args = expr->arguments(); | 3143 ZoneList<Expression*>* args = expr->arguments(); |
3172 DCHECK_EQ(1, args->length()); | 3144 DCHECK_EQ(1, args->length()); |
3173 | 3145 |
3174 // Load the argument into rax and convert it. | 3146 // Load the argument into rax and convert it. |
3175 VisitForAccumulatorValue(args->at(0)); | 3147 VisitForAccumulatorValue(args->at(0)); |
3176 | 3148 |
3177 // Convert the object to an integer. | 3149 // Convert the object to an integer. |
3178 Label done_convert; | 3150 Label done_convert; |
3179 __ JumpIfSmi(rax, &done_convert, Label::kNear); | 3151 __ JumpIfSmi(rax, &done_convert, Label::kNear); |
(...skipping 1327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4507 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 4479 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
4508 Assembler::target_address_at(call_target_address, | 4480 Assembler::target_address_at(call_target_address, |
4509 unoptimized_code)); | 4481 unoptimized_code)); |
4510 return OSR_AFTER_STACK_CHECK; | 4482 return OSR_AFTER_STACK_CHECK; |
4511 } | 4483 } |
4512 | 4484 |
4513 } // namespace internal | 4485 } // namespace internal |
4514 } // namespace v8 | 4486 } // namespace v8 |
4515 | 4487 |
4516 #endif // V8_TARGET_ARCH_X64 | 4488 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |