OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 Label* if_false, | 542 Label* if_false, |
543 Label* fall_through) { | 543 Label* fall_through) { |
544 // Emit the inlined tests assumed by the stub. | 544 // Emit the inlined tests assumed by the stub. |
545 __ CompareRoot(result_register(), Heap::kUndefinedValueRootIndex); | 545 __ CompareRoot(result_register(), Heap::kUndefinedValueRootIndex); |
546 __ j(equal, if_false); | 546 __ j(equal, if_false); |
547 __ CompareRoot(result_register(), Heap::kTrueValueRootIndex); | 547 __ CompareRoot(result_register(), Heap::kTrueValueRootIndex); |
548 __ j(equal, if_true); | 548 __ j(equal, if_true); |
549 __ CompareRoot(result_register(), Heap::kFalseValueRootIndex); | 549 __ CompareRoot(result_register(), Heap::kFalseValueRootIndex); |
550 __ j(equal, if_false); | 550 __ j(equal, if_false); |
551 STATIC_ASSERT(kSmiTag == 0); | 551 STATIC_ASSERT(kSmiTag == 0); |
552 __ SmiCompare(result_register(), Smi::FromInt(0)); | 552 __ Cmp(result_register(), Smi::FromInt(0)); |
553 __ j(equal, if_false); | 553 __ j(equal, if_false); |
554 Condition is_smi = masm_->CheckSmi(result_register()); | 554 Condition is_smi = masm_->CheckSmi(result_register()); |
555 __ j(is_smi, if_true); | 555 __ j(is_smi, if_true); |
556 | 556 |
557 // Call the ToBoolean stub for all other cases. | 557 // Call the ToBoolean stub for all other cases. |
558 ToBooleanStub stub; | 558 ToBooleanStub stub; |
559 __ push(result_register()); | 559 __ push(result_register()); |
560 __ CallStub(&stub); | 560 __ CallStub(&stub); |
561 __ testq(rax, rax); | 561 __ testq(rax, rax); |
562 | 562 |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
988 __ movq(rcx, Operand(rsp, 4 * kPointerSize)); | 988 __ movq(rcx, Operand(rsp, 4 * kPointerSize)); |
989 __ cmpq(rdx, FieldOperand(rcx, HeapObject::kMapOffset)); | 989 __ cmpq(rdx, FieldOperand(rcx, HeapObject::kMapOffset)); |
990 __ j(equal, &update_each); | 990 __ j(equal, &update_each); |
991 | 991 |
992 // Convert the entry to a string or null if it isn't a property | 992 // Convert the entry to a string or null if it isn't a property |
993 // anymore. If the property has been removed while iterating, we | 993 // anymore. If the property has been removed while iterating, we |
994 // just skip it. | 994 // just skip it. |
995 __ push(rcx); // Enumerable. | 995 __ push(rcx); // Enumerable. |
996 __ push(rbx); // Current entry. | 996 __ push(rbx); // Current entry. |
997 __ InvokeBuiltin(Builtins::FILTER_KEY, CALL_FUNCTION); | 997 __ InvokeBuiltin(Builtins::FILTER_KEY, CALL_FUNCTION); |
998 __ SmiCompare(rax, Smi::FromInt(0)); | 998 __ Cmp(rax, Smi::FromInt(0)); |
999 __ j(equal, loop_statement.continue_target()); | 999 __ j(equal, loop_statement.continue_target()); |
1000 __ movq(rbx, rax); | 1000 __ movq(rbx, rax); |
1001 | 1001 |
1002 // Update the 'each' property or variable from the possibly filtered | 1002 // Update the 'each' property or variable from the possibly filtered |
1003 // entry in register rbx. | 1003 // entry in register rbx. |
1004 __ bind(&update_each); | 1004 __ bind(&update_each); |
1005 __ movq(result_register(), rbx); | 1005 __ movq(result_register(), rbx); |
1006 // Perform the assignment as if via '='. | 1006 // Perform the assignment as if via '='. |
1007 { EffectContext context(this); | 1007 { EffectContext context(this); |
1008 EmitAssignment(stmt->each(), stmt->AssignmentId()); | 1008 EmitAssignment(stmt->each(), stmt->AssignmentId()); |
(...skipping 1486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2495 Label* if_false = NULL; | 2495 Label* if_false = NULL; |
2496 Label* fall_through = NULL; | 2496 Label* fall_through = NULL; |
2497 context()->PrepareTest(&materialize_true, &materialize_false, | 2497 context()->PrepareTest(&materialize_true, &materialize_false, |
2498 &if_true, &if_false, &fall_through); | 2498 &if_true, &if_false, &fall_through); |
2499 | 2499 |
2500 // Get the frame pointer for the calling frame. | 2500 // Get the frame pointer for the calling frame. |
2501 __ movq(rax, Operand(rbp, StandardFrameConstants::kCallerFPOffset)); | 2501 __ movq(rax, Operand(rbp, StandardFrameConstants::kCallerFPOffset)); |
2502 | 2502 |
2503 // Skip the arguments adaptor frame if it exists. | 2503 // Skip the arguments adaptor frame if it exists. |
2504 Label check_frame_marker; | 2504 Label check_frame_marker; |
2505 __ SmiCompare(Operand(rax, StandardFrameConstants::kContextOffset), | 2505 __ Cmp(Operand(rax, StandardFrameConstants::kContextOffset), |
2506 Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); | 2506 Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); |
2507 __ j(not_equal, &check_frame_marker); | 2507 __ j(not_equal, &check_frame_marker); |
2508 __ movq(rax, Operand(rax, StandardFrameConstants::kCallerFPOffset)); | 2508 __ movq(rax, Operand(rax, StandardFrameConstants::kCallerFPOffset)); |
2509 | 2509 |
2510 // Check the marker in the calling frame. | 2510 // Check the marker in the calling frame. |
2511 __ bind(&check_frame_marker); | 2511 __ bind(&check_frame_marker); |
2512 __ SmiCompare(Operand(rax, StandardFrameConstants::kMarkerOffset), | 2512 __ Cmp(Operand(rax, StandardFrameConstants::kMarkerOffset), |
2513 Smi::FromInt(StackFrame::CONSTRUCT)); | 2513 Smi::FromInt(StackFrame::CONSTRUCT)); |
2514 PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false); | 2514 PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false); |
2515 Split(equal, if_true, if_false, fall_through); | 2515 Split(equal, if_true, if_false, fall_through); |
2516 | 2516 |
2517 context()->Plug(if_true, if_false); | 2517 context()->Plug(if_true, if_false); |
2518 } | 2518 } |
2519 | 2519 |
2520 | 2520 |
2521 void FullCodeGenerator::EmitObjectEquals(ZoneList<Expression*>* args) { | 2521 void FullCodeGenerator::EmitObjectEquals(ZoneList<Expression*>* args) { |
2522 ASSERT(args->length() == 2); | 2522 ASSERT(args->length() == 2); |
2523 | 2523 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2557 | 2557 |
2558 void FullCodeGenerator::EmitArgumentsLength(ZoneList<Expression*>* args) { | 2558 void FullCodeGenerator::EmitArgumentsLength(ZoneList<Expression*>* args) { |
2559 ASSERT(args->length() == 0); | 2559 ASSERT(args->length() == 0); |
2560 | 2560 |
2561 NearLabel exit; | 2561 NearLabel exit; |
2562 // Get the number of formal parameters. | 2562 // Get the number of formal parameters. |
2563 __ Move(rax, Smi::FromInt(scope()->num_parameters())); | 2563 __ Move(rax, Smi::FromInt(scope()->num_parameters())); |
2564 | 2564 |
2565 // Check if the calling frame is an arguments adaptor frame. | 2565 // Check if the calling frame is an arguments adaptor frame. |
2566 __ movq(rbx, Operand(rbp, StandardFrameConstants::kCallerFPOffset)); | 2566 __ movq(rbx, Operand(rbp, StandardFrameConstants::kCallerFPOffset)); |
2567 __ SmiCompare(Operand(rbx, StandardFrameConstants::kContextOffset), | 2567 __ Cmp(Operand(rbx, StandardFrameConstants::kContextOffset), |
2568 Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); | 2568 Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); |
2569 __ j(not_equal, &exit); | 2569 __ j(not_equal, &exit); |
2570 | 2570 |
2571 // Arguments adaptor case: Read the arguments length from the | 2571 // Arguments adaptor case: Read the arguments length from the |
2572 // adaptor frame. | 2572 // adaptor frame. |
2573 __ movq(rax, Operand(rbx, ArgumentsAdaptorFrameConstants::kLengthOffset)); | 2573 __ movq(rax, Operand(rbx, ArgumentsAdaptorFrameConstants::kLengthOffset)); |
2574 | 2574 |
2575 __ bind(&exit); | 2575 __ bind(&exit); |
2576 if (FLAG_debug_code) __ AbortIfNotSmi(rax); | 2576 if (FLAG_debug_code) __ AbortIfNotSmi(rax); |
2577 context()->Plug(rax); | 2577 context()->Plug(rax); |
2578 } | 2578 } |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3003 Label slow_case; | 3003 Label slow_case; |
3004 Register object = rax; | 3004 Register object = rax; |
3005 Register index_1 = rbx; | 3005 Register index_1 = rbx; |
3006 Register index_2 = rcx; | 3006 Register index_2 = rcx; |
3007 Register elements = rdi; | 3007 Register elements = rdi; |
3008 Register temp = rdx; | 3008 Register temp = rdx; |
3009 __ movq(object, Operand(rsp, 2 * kPointerSize)); | 3009 __ movq(object, Operand(rsp, 2 * kPointerSize)); |
3010 // Fetch the map and check if array is in fast case. | 3010 // Fetch the map and check if array is in fast case. |
3011 // Check that object doesn't require security checks and | 3011 // Check that object doesn't require security checks and |
3012 // has no indexed interceptor. | 3012 // has no indexed interceptor. |
3013 __ CmpObjectType(object, FIRST_JS_OBJECT_TYPE, temp); | 3013 __ CmpObjectType(object, JS_ARRAY_TYPE, temp); |
3014 __ j(below, &slow_case); | 3014 __ j(not_equal, &slow_case); |
3015 __ testb(FieldOperand(temp, Map::kBitFieldOffset), | 3015 __ testb(FieldOperand(temp, Map::kBitFieldOffset), |
3016 Immediate(KeyedLoadIC::kSlowCaseBitFieldMask)); | 3016 Immediate(KeyedLoadIC::kSlowCaseBitFieldMask)); |
3017 __ j(not_zero, &slow_case); | 3017 __ j(not_zero, &slow_case); |
3018 | 3018 |
3019 // Check the object's elements are in fast case and writable. | 3019 // Check the object's elements are in fast case and writable. |
3020 __ movq(elements, FieldOperand(object, JSObject::kElementsOffset)); | 3020 __ movq(elements, FieldOperand(object, JSObject::kElementsOffset)); |
3021 __ CompareRoot(FieldOperand(elements, HeapObject::kMapOffset), | 3021 __ CompareRoot(FieldOperand(elements, HeapObject::kMapOffset), |
3022 Heap::kFixedArrayMapRootIndex); | 3022 Heap::kFixedArrayMapRootIndex); |
3023 __ j(not_equal, &slow_case); | 3023 __ j(not_equal, &slow_case); |
3024 | 3024 |
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3966 __ ret(0); | 3966 __ ret(0); |
3967 } | 3967 } |
3968 | 3968 |
3969 | 3969 |
3970 #undef __ | 3970 #undef __ |
3971 | 3971 |
3972 | 3972 |
3973 } } // namespace v8::internal | 3973 } } // namespace v8::internal |
3974 | 3974 |
3975 #endif // V8_TARGET_ARCH_X64 | 3975 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |