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/full-codegen/full-codegen.h" | 7 #include "src/full-codegen/full-codegen.h" |
8 #include "src/ast/compile-time-value.h" | 8 #include "src/ast/compile-time-value.h" |
9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
948 // it to a JS receiver. See ECMA-262 version 5, section 12.6.4. | 948 // it to a JS receiver. See ECMA-262 version 5, section 12.6.4. |
949 Label convert, done_convert; | 949 Label convert, done_convert; |
950 __ JumpIfSmi(eax, &convert, Label::kNear); | 950 __ JumpIfSmi(eax, &convert, Label::kNear); |
951 __ CmpObjectType(eax, FIRST_JS_RECEIVER_TYPE, ecx); | 951 __ CmpObjectType(eax, FIRST_JS_RECEIVER_TYPE, ecx); |
952 __ j(above_equal, &done_convert, Label::kNear); | 952 __ j(above_equal, &done_convert, Label::kNear); |
953 __ cmp(eax, isolate()->factory()->undefined_value()); | 953 __ cmp(eax, isolate()->factory()->undefined_value()); |
954 __ j(equal, &exit); | 954 __ j(equal, &exit); |
955 __ cmp(eax, isolate()->factory()->null_value()); | 955 __ cmp(eax, isolate()->factory()->null_value()); |
956 __ j(equal, &exit); | 956 __ j(equal, &exit); |
957 __ bind(&convert); | 957 __ bind(&convert); |
958 ToObjectStub stub(isolate()); | 958 __ Call(isolate()->builtins()->ToObject(), RelocInfo::CODE_TARGET); |
959 __ CallStub(&stub); | |
960 RestoreContext(); | 959 RestoreContext(); |
961 __ bind(&done_convert); | 960 __ bind(&done_convert); |
962 PrepareForBailoutForId(stmt->ToObjectId(), BailoutState::TOS_REGISTER); | 961 PrepareForBailoutForId(stmt->ToObjectId(), BailoutState::TOS_REGISTER); |
963 __ push(eax); | 962 __ push(eax); |
964 | 963 |
965 // Check cache validity in generated code. If we cannot guarantee cache | 964 // Check cache validity in generated code. If we cannot guarantee cache |
966 // validity, call the runtime system to check cache validity or get the | 965 // validity, call the runtime system to check cache validity or get the |
967 // property names in a fixed array. Note: Proxies never have an enum cache, | 966 // property names in a fixed array. Note: Proxies never have an enum cache, |
968 // so will always take the slow path. | 967 // so will always take the slow path. |
969 Label call_runtime, use_cache, fixed_array; | 968 Label call_runtime, use_cache, fixed_array; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1038 __ cmp(edx, FieldOperand(ebx, HeapObject::kMapOffset)); | 1037 __ cmp(edx, FieldOperand(ebx, HeapObject::kMapOffset)); |
1039 __ j(equal, &update_each, Label::kNear); | 1038 __ j(equal, &update_each, Label::kNear); |
1040 | 1039 |
1041 // We need to filter the key, record slow-path here. | 1040 // We need to filter the key, record slow-path here. |
1042 int const vector_index = SmiFromSlot(slot)->value(); | 1041 int const vector_index = SmiFromSlot(slot)->value(); |
1043 __ EmitLoadTypeFeedbackVector(edx); | 1042 __ EmitLoadTypeFeedbackVector(edx); |
1044 __ mov(FieldOperand(edx, FixedArray::OffsetOfElementAt(vector_index)), | 1043 __ mov(FieldOperand(edx, FixedArray::OffsetOfElementAt(vector_index)), |
1045 Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate()))); | 1044 Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate()))); |
1046 | 1045 |
1047 // eax contains the key. The receiver in ebx is the second argument to the | 1046 // eax contains the key. The receiver in ebx is the second argument to the |
1048 // ForInFilterStub. ForInFilter returns undefined if the receiver doesn't | 1047 // ForInFilter. ForInFilter returns undefined if the receiver doesn't |
1049 // have the key or returns the name-converted key. | 1048 // have the key or returns the name-converted key. |
1050 ForInFilterStub filter_stub(isolate()); | 1049 __ Call(isolate()->builtins()->ForInFilter(), RelocInfo::CODE_TARGET); |
1051 __ CallStub(&filter_stub); | |
1052 RestoreContext(); | 1050 RestoreContext(); |
1053 PrepareForBailoutForId(stmt->FilterId(), BailoutState::TOS_REGISTER); | 1051 PrepareForBailoutForId(stmt->FilterId(), BailoutState::TOS_REGISTER); |
1054 __ JumpIfRoot(result_register(), Heap::kUndefinedValueRootIndex, | 1052 __ JumpIfRoot(result_register(), Heap::kUndefinedValueRootIndex, |
1055 loop_statement.continue_label()); | 1053 loop_statement.continue_label()); |
1056 | 1054 |
1057 // Update the 'each' property or variable from the possibly filtered | 1055 // Update the 'each' property or variable from the possibly filtered |
1058 // entry in register eax. | 1056 // entry in register eax. |
1059 __ bind(&update_each); | 1057 __ bind(&update_each); |
1060 // Perform the assignment as if via '='. | 1058 // Perform the assignment as if via '='. |
1061 { EffectContext context(this); | 1059 { EffectContext context(this); |
(...skipping 1877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2939 break; | 2937 break; |
2940 } | 2938 } |
2941 | 2939 |
2942 case Token::TYPEOF: { | 2940 case Token::TYPEOF: { |
2943 Comment cmnt(masm_, "[ UnaryOperation (TYPEOF)"); | 2941 Comment cmnt(masm_, "[ UnaryOperation (TYPEOF)"); |
2944 { | 2942 { |
2945 AccumulatorValueContext context(this); | 2943 AccumulatorValueContext context(this); |
2946 VisitForTypeofValue(expr->expression()); | 2944 VisitForTypeofValue(expr->expression()); |
2947 } | 2945 } |
2948 __ mov(ebx, eax); | 2946 __ mov(ebx, eax); |
2949 TypeofStub typeof_stub(isolate()); | 2947 __ Call(isolate()->builtins()->Typeof(), RelocInfo::CODE_TARGET); |
2950 __ CallStub(&typeof_stub); | |
2951 context()->Plug(eax); | 2948 context()->Plug(eax); |
2952 break; | 2949 break; |
2953 } | 2950 } |
2954 | 2951 |
2955 default: | 2952 default: |
2956 UNREACHABLE(); | 2953 UNREACHABLE(); |
2957 } | 2954 } |
2958 } | 2955 } |
2959 | 2956 |
2960 | 2957 |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3310 EmitHasProperty(); | 3307 EmitHasProperty(); |
3311 PrepareForBailoutBeforeSplit(expr, false, NULL, NULL); | 3308 PrepareForBailoutBeforeSplit(expr, false, NULL, NULL); |
3312 __ cmp(eax, isolate()->factory()->true_value()); | 3309 __ cmp(eax, isolate()->factory()->true_value()); |
3313 Split(equal, if_true, if_false, fall_through); | 3310 Split(equal, if_true, if_false, fall_through); |
3314 break; | 3311 break; |
3315 | 3312 |
3316 case Token::INSTANCEOF: { | 3313 case Token::INSTANCEOF: { |
3317 VisitForAccumulatorValue(expr->right()); | 3314 VisitForAccumulatorValue(expr->right()); |
3318 SetExpressionPosition(expr); | 3315 SetExpressionPosition(expr); |
3319 PopOperand(edx); | 3316 PopOperand(edx); |
3320 InstanceOfStub stub(isolate()); | 3317 __ Call(isolate()->builtins()->InstanceOf(), RelocInfo::CODE_TARGET); |
3321 __ CallStub(&stub); | |
3322 PrepareForBailoutBeforeSplit(expr, false, NULL, NULL); | 3318 PrepareForBailoutBeforeSplit(expr, false, NULL, NULL); |
3323 __ cmp(eax, isolate()->factory()->true_value()); | 3319 __ cmp(eax, isolate()->factory()->true_value()); |
3324 Split(equal, if_true, if_false, fall_through); | 3320 Split(equal, if_true, if_false, fall_through); |
3325 break; | 3321 break; |
3326 } | 3322 } |
3327 | 3323 |
3328 default: { | 3324 default: { |
3329 VisitForAccumulatorValue(expr->right()); | 3325 VisitForAccumulatorValue(expr->right()); |
3330 SetExpressionPosition(expr); | 3326 SetExpressionPosition(expr); |
3331 Condition cc = CompareIC::ComputeCondition(op); | 3327 Condition cc = CompareIC::ComputeCondition(op); |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3566 isolate->builtins()->OnStackReplacement()->entry(), | 3562 isolate->builtins()->OnStackReplacement()->entry(), |
3567 Assembler::target_address_at(call_target_address, unoptimized_code)); | 3563 Assembler::target_address_at(call_target_address, unoptimized_code)); |
3568 return ON_STACK_REPLACEMENT; | 3564 return ON_STACK_REPLACEMENT; |
3569 } | 3565 } |
3570 | 3566 |
3571 | 3567 |
3572 } // namespace internal | 3568 } // namespace internal |
3573 } // namespace v8 | 3569 } // namespace v8 |
3574 | 3570 |
3575 #endif // V8_TARGET_ARCH_IA32 | 3571 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |