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/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/compiler.h" | 10 #include "src/compiler.h" |
(...skipping 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1196 } else { | 1196 } else { |
1197 __ Push(info); | 1197 __ Push(info); |
1198 __ CallRuntime( | 1198 __ CallRuntime( |
1199 pretenure ? Runtime::kNewClosure_Tenured : Runtime::kNewClosure, 1); | 1199 pretenure ? Runtime::kNewClosure_Tenured : Runtime::kNewClosure, 1); |
1200 } | 1200 } |
1201 context()->Plug(rax); | 1201 context()->Plug(rax); |
1202 } | 1202 } |
1203 | 1203 |
1204 | 1204 |
1205 void FullCodeGenerator::EmitSetHomeObject(Expression* initializer, int offset, | 1205 void FullCodeGenerator::EmitSetHomeObject(Expression* initializer, int offset, |
1206 FeedbackVectorICSlot slot) { | 1206 FeedbackVectorSlot slot) { |
1207 DCHECK(NeedsHomeObject(initializer)); | 1207 DCHECK(NeedsHomeObject(initializer)); |
1208 __ movp(StoreDescriptor::ReceiverRegister(), Operand(rsp, 0)); | 1208 __ movp(StoreDescriptor::ReceiverRegister(), Operand(rsp, 0)); |
1209 __ Move(StoreDescriptor::NameRegister(), | 1209 __ Move(StoreDescriptor::NameRegister(), |
1210 isolate()->factory()->home_object_symbol()); | 1210 isolate()->factory()->home_object_symbol()); |
1211 __ movp(StoreDescriptor::ValueRegister(), | 1211 __ movp(StoreDescriptor::ValueRegister(), |
1212 Operand(rsp, offset * kPointerSize)); | 1212 Operand(rsp, offset * kPointerSize)); |
1213 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); | 1213 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); |
1214 CallStoreIC(); | 1214 CallStoreIC(); |
1215 } | 1215 } |
1216 | 1216 |
1217 | 1217 |
1218 void FullCodeGenerator::EmitSetHomeObjectAccumulator( | 1218 void FullCodeGenerator::EmitSetHomeObjectAccumulator(Expression* initializer, |
1219 Expression* initializer, int offset, FeedbackVectorICSlot slot) { | 1219 int offset, |
| 1220 FeedbackVectorSlot slot) { |
1220 DCHECK(NeedsHomeObject(initializer)); | 1221 DCHECK(NeedsHomeObject(initializer)); |
1221 __ movp(StoreDescriptor::ReceiverRegister(), rax); | 1222 __ movp(StoreDescriptor::ReceiverRegister(), rax); |
1222 __ Move(StoreDescriptor::NameRegister(), | 1223 __ Move(StoreDescriptor::NameRegister(), |
1223 isolate()->factory()->home_object_symbol()); | 1224 isolate()->factory()->home_object_symbol()); |
1224 __ movp(StoreDescriptor::ValueRegister(), | 1225 __ movp(StoreDescriptor::ValueRegister(), |
1225 Operand(rsp, offset * kPointerSize)); | 1226 Operand(rsp, offset * kPointerSize)); |
1226 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); | 1227 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); |
1227 CallStoreIC(); | 1228 CallStoreIC(); |
1228 } | 1229 } |
1229 | 1230 |
(...skipping 1174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2404 Handle<Code> code = | 2405 Handle<Code> code = |
2405 CodeFactory::BinaryOpIC(isolate(), op, strength(language_mode())).code(); | 2406 CodeFactory::BinaryOpIC(isolate(), op, strength(language_mode())).code(); |
2406 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. | 2407 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. |
2407 CallIC(code, expr->BinaryOperationFeedbackId()); | 2408 CallIC(code, expr->BinaryOperationFeedbackId()); |
2408 patch_site.EmitPatchInfo(); | 2409 patch_site.EmitPatchInfo(); |
2409 context()->Plug(rax); | 2410 context()->Plug(rax); |
2410 } | 2411 } |
2411 | 2412 |
2412 | 2413 |
2413 void FullCodeGenerator::EmitAssignment(Expression* expr, | 2414 void FullCodeGenerator::EmitAssignment(Expression* expr, |
2414 FeedbackVectorICSlot slot) { | 2415 FeedbackVectorSlot slot) { |
2415 DCHECK(expr->IsValidReferenceExpressionOrThis()); | 2416 DCHECK(expr->IsValidReferenceExpressionOrThis()); |
2416 | 2417 |
2417 Property* prop = expr->AsProperty(); | 2418 Property* prop = expr->AsProperty(); |
2418 LhsKind assign_type = Property::GetAssignType(prop); | 2419 LhsKind assign_type = Property::GetAssignType(prop); |
2419 | 2420 |
2420 switch (assign_type) { | 2421 switch (assign_type) { |
2421 case VARIABLE: { | 2422 case VARIABLE: { |
2422 Variable* var = expr->AsVariableProxy()->var(); | 2423 Variable* var = expr->AsVariableProxy()->var(); |
2423 EffectContext context(this); | 2424 EffectContext context(this); |
2424 EmitVariableAssignment(var, Token::ASSIGN, slot); | 2425 EmitVariableAssignment(var, Token::ASSIGN, slot); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2495 __ movp(location, rax); | 2496 __ movp(location, rax); |
2496 if (var->IsContextSlot()) { | 2497 if (var->IsContextSlot()) { |
2497 __ movp(rdx, rax); | 2498 __ movp(rdx, rax); |
2498 __ RecordWriteContextSlot( | 2499 __ RecordWriteContextSlot( |
2499 rcx, Context::SlotOffset(var->index()), rdx, rbx, kDontSaveFPRegs); | 2500 rcx, Context::SlotOffset(var->index()), rdx, rbx, kDontSaveFPRegs); |
2500 } | 2501 } |
2501 } | 2502 } |
2502 | 2503 |
2503 | 2504 |
2504 void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op, | 2505 void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op, |
2505 FeedbackVectorICSlot slot) { | 2506 FeedbackVectorSlot slot) { |
2506 if (var->IsUnallocated()) { | 2507 if (var->IsUnallocated()) { |
2507 // Global var, const, or let. | 2508 // Global var, const, or let. |
2508 __ Move(StoreDescriptor::NameRegister(), var->name()); | 2509 __ Move(StoreDescriptor::NameRegister(), var->name()); |
2509 __ movp(StoreDescriptor::ReceiverRegister(), GlobalObjectOperand()); | 2510 __ movp(StoreDescriptor::ReceiverRegister(), GlobalObjectOperand()); |
2510 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); | 2511 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); |
2511 CallStoreIC(); | 2512 CallStoreIC(); |
2512 | 2513 |
2513 } else if (var->IsGlobalSlot()) { | 2514 } else if (var->IsGlobalSlot()) { |
2514 // Global var, const, or let. | 2515 // Global var, const, or let. |
2515 DCHECK(var->index() > 0); | 2516 DCHECK(var->index() > 0); |
(...skipping 2552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5068 | 5069 |
5069 void FullCodeGenerator::ClearPendingMessage() { | 5070 void FullCodeGenerator::ClearPendingMessage() { |
5070 DCHECK(!result_register().is(rdx)); | 5071 DCHECK(!result_register().is(rdx)); |
5071 ExternalReference pending_message_obj = | 5072 ExternalReference pending_message_obj = |
5072 ExternalReference::address_of_pending_message_obj(isolate()); | 5073 ExternalReference::address_of_pending_message_obj(isolate()); |
5073 __ LoadRoot(rdx, Heap::kTheHoleValueRootIndex); | 5074 __ LoadRoot(rdx, Heap::kTheHoleValueRootIndex); |
5074 __ Store(pending_message_obj, rdx); | 5075 __ Store(pending_message_obj, rdx); |
5075 } | 5076 } |
5076 | 5077 |
5077 | 5078 |
5078 void FullCodeGenerator::EmitLoadStoreICSlot(FeedbackVectorICSlot slot) { | 5079 void FullCodeGenerator::EmitLoadStoreICSlot(FeedbackVectorSlot slot) { |
5079 DCHECK(FLAG_vector_stores && !slot.IsInvalid()); | 5080 DCHECK(FLAG_vector_stores && !slot.IsInvalid()); |
5080 __ Move(VectorStoreICTrampolineDescriptor::SlotRegister(), SmiFromSlot(slot)); | 5081 __ Move(VectorStoreICTrampolineDescriptor::SlotRegister(), SmiFromSlot(slot)); |
5081 } | 5082 } |
5082 | 5083 |
5083 | 5084 |
5084 #undef __ | 5085 #undef __ |
5085 | 5086 |
5086 | 5087 |
5087 static const byte kJnsInstruction = 0x79; | 5088 static const byte kJnsInstruction = 0x79; |
5088 static const byte kNopByteOne = 0x66; | 5089 static const byte kNopByteOne = 0x66; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5158 Assembler::target_address_at(call_target_address, | 5159 Assembler::target_address_at(call_target_address, |
5159 unoptimized_code)); | 5160 unoptimized_code)); |
5160 return OSR_AFTER_STACK_CHECK; | 5161 return OSR_AFTER_STACK_CHECK; |
5161 } | 5162 } |
5162 | 5163 |
5163 | 5164 |
5164 } // namespace internal | 5165 } // namespace internal |
5165 } // namespace v8 | 5166 } // namespace v8 |
5166 | 5167 |
5167 #endif // V8_TARGET_ARCH_X64 | 5168 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |