OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
752 Split(equal, if_true, if_false, NULL); | 752 Split(equal, if_true, if_false, NULL); |
753 __ bind(&skip); | 753 __ bind(&skip); |
754 } | 754 } |
755 } | 755 } |
756 | 756 |
757 | 757 |
758 void FullCodeGenerator::EmitDebugCheckDeclarationContext(Variable* variable) { | 758 void FullCodeGenerator::EmitDebugCheckDeclarationContext(Variable* variable) { |
759 // The variable in the declaration always resides in the current function | 759 // The variable in the declaration always resides in the current function |
760 // context. | 760 // context. |
761 ASSERT_EQ(0, scope()->ContextChainLength(variable->scope())); | 761 ASSERT_EQ(0, scope()->ContextChainLength(variable->scope())); |
762 if (FLAG_debug_code) { | 762 if (generate_debug_code_) { |
763 // Check that we're not inside a with or catch context. | 763 // Check that we're not inside a with or catch context. |
764 __ movq(rbx, FieldOperand(rsi, HeapObject::kMapOffset)); | 764 __ movq(rbx, FieldOperand(rsi, HeapObject::kMapOffset)); |
765 __ CompareRoot(rbx, Heap::kWithContextMapRootIndex); | 765 __ CompareRoot(rbx, Heap::kWithContextMapRootIndex); |
766 __ Check(not_equal, "Declaration in with context."); | 766 __ Check(not_equal, "Declaration in with context."); |
767 __ CompareRoot(rbx, Heap::kCatchContextMapRootIndex); | 767 __ CompareRoot(rbx, Heap::kCatchContextMapRootIndex); |
768 __ Check(not_equal, "Declaration in catch context."); | 768 __ Check(not_equal, "Declaration in catch context."); |
769 } | 769 } |
770 } | 770 } |
771 | 771 |
772 | 772 |
(...skipping 1292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2065 __ RecordWriteContextSlot( | 2065 __ RecordWriteContextSlot( |
2066 rcx, Context::SlotOffset(var->index()), rdx, rbx, kDontSaveFPRegs); | 2066 rcx, Context::SlotOffset(var->index()), rdx, rbx, kDontSaveFPRegs); |
2067 } | 2067 } |
2068 } | 2068 } |
2069 | 2069 |
2070 } else if (!var->is_const_mode() || op == Token::INIT_CONST_HARMONY) { | 2070 } else if (!var->is_const_mode() || op == Token::INIT_CONST_HARMONY) { |
2071 // Assignment to var or initializing assignment to let/const | 2071 // Assignment to var or initializing assignment to let/const |
2072 // in harmony mode. | 2072 // in harmony mode. |
2073 if (var->IsStackAllocated() || var->IsContextSlot()) { | 2073 if (var->IsStackAllocated() || var->IsContextSlot()) { |
2074 MemOperand location = VarOperand(var, rcx); | 2074 MemOperand location = VarOperand(var, rcx); |
2075 if (FLAG_debug_code && op == Token::INIT_LET) { | 2075 if (generate_debug_code_ && op == Token::INIT_LET) { |
2076 // Check for an uninitialized let binding. | 2076 // Check for an uninitialized let binding. |
2077 __ movq(rdx, location); | 2077 __ movq(rdx, location); |
2078 __ CompareRoot(rdx, Heap::kTheHoleValueRootIndex); | 2078 __ CompareRoot(rdx, Heap::kTheHoleValueRootIndex); |
2079 __ Check(equal, "Let binding re-initialization."); | 2079 __ Check(equal, "Let binding re-initialization."); |
2080 } | 2080 } |
2081 // Perform the assignment. | 2081 // Perform the assignment. |
2082 __ movq(location, rax); | 2082 __ movq(location, rax); |
2083 if (var->IsContextSlot()) { | 2083 if (var->IsContextSlot()) { |
2084 __ movq(rdx, rax); | 2084 __ movq(rdx, rax); |
2085 __ RecordWriteContextSlot( | 2085 __ RecordWriteContextSlot( |
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2605 | 2605 |
2606 VisitForAccumulatorValue(args->at(0)); | 2606 VisitForAccumulatorValue(args->at(0)); |
2607 | 2607 |
2608 Label materialize_true, materialize_false; | 2608 Label materialize_true, materialize_false; |
2609 Label* if_true = NULL; | 2609 Label* if_true = NULL; |
2610 Label* if_false = NULL; | 2610 Label* if_false = NULL; |
2611 Label* fall_through = NULL; | 2611 Label* fall_through = NULL; |
2612 context()->PrepareTest(&materialize_true, &materialize_false, | 2612 context()->PrepareTest(&materialize_true, &materialize_false, |
2613 &if_true, &if_false, &fall_through); | 2613 &if_true, &if_false, &fall_through); |
2614 | 2614 |
2615 if (FLAG_debug_code) __ AbortIfSmi(rax); | 2615 if (generate_debug_code_) __ AbortIfSmi(rax); |
2616 | 2616 |
2617 // Check whether this map has already been checked to be safe for default | 2617 // Check whether this map has already been checked to be safe for default |
2618 // valueOf. | 2618 // valueOf. |
2619 __ movq(rbx, FieldOperand(rax, HeapObject::kMapOffset)); | 2619 __ movq(rbx, FieldOperand(rax, HeapObject::kMapOffset)); |
2620 __ testb(FieldOperand(rbx, Map::kBitField2Offset), | 2620 __ testb(FieldOperand(rbx, Map::kBitField2Offset), |
2621 Immediate(1 << Map::kStringWrapperSafeForDefaultValueOf)); | 2621 Immediate(1 << Map::kStringWrapperSafeForDefaultValueOf)); |
2622 __ j(not_zero, if_true); | 2622 __ j(not_zero, if_true); |
2623 | 2623 |
2624 // Check for fast case object. Generate false result for slow case object. | 2624 // Check for fast case object. Generate false result for slow case object. |
2625 __ movq(rcx, FieldOperand(rax, JSObject::kPropertiesOffset)); | 2625 __ movq(rcx, FieldOperand(rax, JSObject::kPropertiesOffset)); |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2829 __ movq(rbx, Operand(rbp, StandardFrameConstants::kCallerFPOffset)); | 2829 __ movq(rbx, Operand(rbp, StandardFrameConstants::kCallerFPOffset)); |
2830 __ Cmp(Operand(rbx, StandardFrameConstants::kContextOffset), | 2830 __ Cmp(Operand(rbx, StandardFrameConstants::kContextOffset), |
2831 Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); | 2831 Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); |
2832 __ j(not_equal, &exit, Label::kNear); | 2832 __ j(not_equal, &exit, Label::kNear); |
2833 | 2833 |
2834 // Arguments adaptor case: Read the arguments length from the | 2834 // Arguments adaptor case: Read the arguments length from the |
2835 // adaptor frame. | 2835 // adaptor frame. |
2836 __ movq(rax, Operand(rbx, ArgumentsAdaptorFrameConstants::kLengthOffset)); | 2836 __ movq(rax, Operand(rbx, ArgumentsAdaptorFrameConstants::kLengthOffset)); |
2837 | 2837 |
2838 __ bind(&exit); | 2838 __ bind(&exit); |
2839 if (FLAG_debug_code) __ AbortIfNotSmi(rax); | 2839 if (generate_debug_code_) __ AbortIfNotSmi(rax); |
2840 context()->Plug(rax); | 2840 context()->Plug(rax); |
2841 } | 2841 } |
2842 | 2842 |
2843 | 2843 |
2844 void FullCodeGenerator::EmitClassOf(CallRuntime* expr) { | 2844 void FullCodeGenerator::EmitClassOf(CallRuntime* expr) { |
2845 ZoneList<Expression*>* args = expr->arguments(); | 2845 ZoneList<Expression*>* args = expr->arguments(); |
2846 ASSERT(args->length() == 1); | 2846 ASSERT(args->length() == 1); |
2847 Label done, null, function, non_function_constructor; | 2847 Label done, null, function, non_function_constructor; |
2848 | 2848 |
2849 VisitForAccumulatorValue(args->at(0)); | 2849 VisitForAccumulatorValue(args->at(0)); |
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3473 | 3473 |
3474 context()->Plug(if_true, if_false); | 3474 context()->Plug(if_true, if_false); |
3475 } | 3475 } |
3476 | 3476 |
3477 | 3477 |
3478 void FullCodeGenerator::EmitGetCachedArrayIndex(CallRuntime* expr) { | 3478 void FullCodeGenerator::EmitGetCachedArrayIndex(CallRuntime* expr) { |
3479 ZoneList<Expression*>* args = expr->arguments(); | 3479 ZoneList<Expression*>* args = expr->arguments(); |
3480 ASSERT(args->length() == 1); | 3480 ASSERT(args->length() == 1); |
3481 VisitForAccumulatorValue(args->at(0)); | 3481 VisitForAccumulatorValue(args->at(0)); |
3482 | 3482 |
3483 if (FLAG_debug_code) { | 3483 if (generate_debug_code_) { |
3484 __ AbortIfNotString(rax); | 3484 __ AbortIfNotString(rax); |
3485 } | 3485 } |
3486 | 3486 |
3487 __ movl(rax, FieldOperand(rax, String::kHashFieldOffset)); | 3487 __ movl(rax, FieldOperand(rax, String::kHashFieldOffset)); |
3488 ASSERT(String::kHashShift >= kSmiTagSize); | 3488 ASSERT(String::kHashShift >= kSmiTagSize); |
3489 __ IndexFromHash(rax, rax); | 3489 __ IndexFromHash(rax, rax); |
3490 | 3490 |
3491 context()->Plug(rax); | 3491 context()->Plug(rax); |
3492 } | 3492 } |
3493 | 3493 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3553 array = no_reg; | 3553 array = no_reg; |
3554 | 3554 |
3555 | 3555 |
3556 // Check that all array elements are sequential ASCII strings, and | 3556 // Check that all array elements are sequential ASCII strings, and |
3557 // accumulate the sum of their lengths, as a smi-encoded value. | 3557 // accumulate the sum of their lengths, as a smi-encoded value. |
3558 __ Set(index, 0); | 3558 __ Set(index, 0); |
3559 __ Set(string_length, 0); | 3559 __ Set(string_length, 0); |
3560 // Loop condition: while (index < array_length). | 3560 // Loop condition: while (index < array_length). |
3561 // Live loop registers: index(int32), array_length(int32), string(String*), | 3561 // Live loop registers: index(int32), array_length(int32), string(String*), |
3562 // scratch, string_length(int32), elements(FixedArray*). | 3562 // scratch, string_length(int32), elements(FixedArray*). |
3563 if (FLAG_debug_code) { | 3563 if (generate_debug_code_) { |
3564 __ cmpq(index, array_length); | 3564 __ cmpq(index, array_length); |
3565 __ Assert(below, "No empty arrays here in EmitFastAsciiArrayJoin"); | 3565 __ Assert(below, "No empty arrays here in EmitFastAsciiArrayJoin"); |
3566 } | 3566 } |
3567 __ bind(&loop); | 3567 __ bind(&loop); |
3568 __ movq(string, FieldOperand(elements, | 3568 __ movq(string, FieldOperand(elements, |
3569 index, | 3569 index, |
3570 times_pointer_size, | 3570 times_pointer_size, |
3571 FixedArray::kHeaderSize)); | 3571 FixedArray::kHeaderSize)); |
3572 __ JumpIfSmi(string, &bailout); | 3572 __ JumpIfSmi(string, &bailout); |
3573 __ movq(scratch, FieldOperand(string, HeapObject::kMapOffset)); | 3573 __ movq(scratch, FieldOperand(string, HeapObject::kMapOffset)); |
(...skipping 962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4536 *context_length = 0; | 4536 *context_length = 0; |
4537 return previous_; | 4537 return previous_; |
4538 } | 4538 } |
4539 | 4539 |
4540 | 4540 |
4541 #undef __ | 4541 #undef __ |
4542 | 4542 |
4543 } } // namespace v8::internal | 4543 } } // namespace v8::internal |
4544 | 4544 |
4545 #endif // V8_TARGET_ARCH_X64 | 4545 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |