Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(332)

Side by Side Diff: src/x64/macro-assembler-x64.cc

Issue 10442015: Rollback of r11638, r11636 on trunk branch. (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/x64/macro-assembler-x64.h ('k') | src/x64/stub-cache-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2640 matching lines...) Expand 10 before | Expand all | Expand 10 after
2651 2651
2652 void MacroAssembler::CmpInstanceType(Register map, InstanceType type) { 2652 void MacroAssembler::CmpInstanceType(Register map, InstanceType type) {
2653 cmpb(FieldOperand(map, Map::kInstanceTypeOffset), 2653 cmpb(FieldOperand(map, Map::kInstanceTypeOffset),
2654 Immediate(static_cast<int8_t>(type))); 2654 Immediate(static_cast<int8_t>(type)));
2655 } 2655 }
2656 2656
2657 2657
2658 void MacroAssembler::CheckFastElements(Register map, 2658 void MacroAssembler::CheckFastElements(Register map,
2659 Label* fail, 2659 Label* fail,
2660 Label::Distance distance) { 2660 Label::Distance distance) {
2661 STATIC_ASSERT(FAST_SMI_ELEMENTS == 0); 2661 STATIC_ASSERT(FAST_SMI_ONLY_ELEMENTS == 0);
2662 STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1); 2662 STATIC_ASSERT(FAST_ELEMENTS == 1);
2663 STATIC_ASSERT(FAST_ELEMENTS == 2);
2664 STATIC_ASSERT(FAST_HOLEY_ELEMENTS == 3);
2665 cmpb(FieldOperand(map, Map::kBitField2Offset), 2663 cmpb(FieldOperand(map, Map::kBitField2Offset),
2666 Immediate(Map::kMaximumBitField2FastHoleyElementValue)); 2664 Immediate(Map::kMaximumBitField2FastElementValue));
2667 j(above, fail, distance); 2665 j(above, fail, distance);
2668 } 2666 }
2669 2667
2670 2668
2671 void MacroAssembler::CheckFastObjectElements(Register map, 2669 void MacroAssembler::CheckFastObjectElements(Register map,
2672 Label* fail, 2670 Label* fail,
2673 Label::Distance distance) { 2671 Label::Distance distance) {
2674 STATIC_ASSERT(FAST_SMI_ELEMENTS == 0); 2672 STATIC_ASSERT(FAST_SMI_ONLY_ELEMENTS == 0);
2675 STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1); 2673 STATIC_ASSERT(FAST_ELEMENTS == 1);
2676 STATIC_ASSERT(FAST_ELEMENTS == 2);
2677 STATIC_ASSERT(FAST_HOLEY_ELEMENTS == 3);
2678 cmpb(FieldOperand(map, Map::kBitField2Offset), 2674 cmpb(FieldOperand(map, Map::kBitField2Offset),
2679 Immediate(Map::kMaximumBitField2FastHoleySmiElementValue)); 2675 Immediate(Map::kMaximumBitField2FastSmiOnlyElementValue));
2680 j(below_equal, fail, distance); 2676 j(below_equal, fail, distance);
2681 cmpb(FieldOperand(map, Map::kBitField2Offset), 2677 cmpb(FieldOperand(map, Map::kBitField2Offset),
2682 Immediate(Map::kMaximumBitField2FastHoleyElementValue)); 2678 Immediate(Map::kMaximumBitField2FastElementValue));
2683 j(above, fail, distance); 2679 j(above, fail, distance);
2684 } 2680 }
2685 2681
2686 2682
2687 void MacroAssembler::CheckFastSmiElements(Register map, 2683 void MacroAssembler::CheckFastSmiOnlyElements(Register map,
2688 Label* fail, 2684 Label* fail,
2689 Label::Distance distance) { 2685 Label::Distance distance) {
2690 STATIC_ASSERT(FAST_SMI_ELEMENTS == 0); 2686 STATIC_ASSERT(FAST_SMI_ONLY_ELEMENTS == 0);
2691 STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1);
2692 cmpb(FieldOperand(map, Map::kBitField2Offset), 2687 cmpb(FieldOperand(map, Map::kBitField2Offset),
2693 Immediate(Map::kMaximumBitField2FastHoleySmiElementValue)); 2688 Immediate(Map::kMaximumBitField2FastSmiOnlyElementValue));
2694 j(above, fail, distance); 2689 j(above, fail, distance);
2695 } 2690 }
2696 2691
2697 2692
2698 void MacroAssembler::StoreNumberToDoubleElements( 2693 void MacroAssembler::StoreNumberToDoubleElements(
2699 Register maybe_number, 2694 Register maybe_number,
2700 Register elements, 2695 Register elements,
2701 Register index, 2696 Register index,
2702 XMMRegister xmm_scratch, 2697 XMMRegister xmm_scratch,
2703 Label* fail) { 2698 Label* fail) {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
2747 bind(&done); 2742 bind(&done);
2748 } 2743 }
2749 2744
2750 2745
2751 void MacroAssembler::CompareMap(Register obj, 2746 void MacroAssembler::CompareMap(Register obj,
2752 Handle<Map> map, 2747 Handle<Map> map,
2753 Label* early_success, 2748 Label* early_success,
2754 CompareMapMode mode) { 2749 CompareMapMode mode) {
2755 Cmp(FieldOperand(obj, HeapObject::kMapOffset), map); 2750 Cmp(FieldOperand(obj, HeapObject::kMapOffset), map);
2756 if (mode == ALLOW_ELEMENT_TRANSITION_MAPS) { 2751 if (mode == ALLOW_ELEMENT_TRANSITION_MAPS) {
2757 ElementsKind kind = map->elements_kind(); 2752 Map* transitioned_fast_element_map(
2758 if (IsFastElementsKind(kind)) { 2753 map->LookupElementsTransitionMap(FAST_ELEMENTS, NULL));
2759 bool packed = IsFastPackedElementsKind(kind); 2754 ASSERT(transitioned_fast_element_map == NULL ||
2760 Map* current_map = *map; 2755 map->elements_kind() != FAST_ELEMENTS);
2761 while (CanTransitionToMoreGeneralFastElementsKind(kind, packed)) { 2756 if (transitioned_fast_element_map != NULL) {
2762 kind = GetNextMoreGeneralFastElementsKind(kind, packed); 2757 j(equal, early_success, Label::kNear);
2763 current_map = current_map->LookupElementsTransitionMap(kind, NULL); 2758 Cmp(FieldOperand(obj, HeapObject::kMapOffset),
2764 if (!current_map) break; 2759 Handle<Map>(transitioned_fast_element_map));
2765 j(equal, early_success, Label::kNear); 2760 }
2766 Cmp(FieldOperand(obj, HeapObject::kMapOffset), 2761
2767 Handle<Map>(current_map)); 2762 Map* transitioned_double_map(
2768 } 2763 map->LookupElementsTransitionMap(FAST_DOUBLE_ELEMENTS, NULL));
2764 ASSERT(transitioned_double_map == NULL ||
2765 map->elements_kind() == FAST_SMI_ONLY_ELEMENTS);
2766 if (transitioned_double_map != NULL) {
2767 j(equal, early_success, Label::kNear);
2768 Cmp(FieldOperand(obj, HeapObject::kMapOffset),
2769 Handle<Map>(transitioned_double_map));
2769 } 2770 }
2770 } 2771 }
2771 } 2772 }
2772 2773
2773 2774
2774 void MacroAssembler::CheckMap(Register obj, 2775 void MacroAssembler::CheckMap(Register obj,
2775 Handle<Map> map, 2776 Handle<Map> map,
2776 Label* fail, 2777 Label* fail,
2777 SmiCheckType smi_check_type, 2778 SmiCheckType smi_check_type,
2778 CompareMapMode mode) { 2779 CompareMapMode mode) {
(...skipping 1270 matching lines...) Expand 10 before | Expand all | Expand 10 after
4049 ElementsKind expected_kind, 4050 ElementsKind expected_kind,
4050 ElementsKind transitioned_kind, 4051 ElementsKind transitioned_kind,
4051 Register map_in_out, 4052 Register map_in_out,
4052 Register scratch, 4053 Register scratch,
4053 Label* no_map_match) { 4054 Label* no_map_match) {
4054 // Load the global or builtins object from the current context. 4055 // Load the global or builtins object from the current context.
4055 movq(scratch, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX))); 4056 movq(scratch, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX)));
4056 movq(scratch, FieldOperand(scratch, GlobalObject::kGlobalContextOffset)); 4057 movq(scratch, FieldOperand(scratch, GlobalObject::kGlobalContextOffset));
4057 4058
4058 // Check that the function's map is the same as the expected cached map. 4059 // Check that the function's map is the same as the expected cached map.
4059 movq(scratch, Operand(scratch, 4060 int expected_index =
4060 Context::SlotOffset(Context::JS_ARRAY_MAPS_INDEX))); 4061 Context::GetContextMapIndexFromElementsKind(expected_kind);
4061 4062 cmpq(map_in_out, Operand(scratch, Context::SlotOffset(expected_index)));
4062 int offset = expected_kind * kPointerSize +
4063 FixedArrayBase::kHeaderSize;
4064 cmpq(map_in_out, FieldOperand(scratch, offset));
4065 j(not_equal, no_map_match); 4063 j(not_equal, no_map_match);
4066 4064
4067 // Use the transitioned cached map. 4065 // Use the transitioned cached map.
4068 offset = transitioned_kind * kPointerSize + 4066 int trans_index =
4069 FixedArrayBase::kHeaderSize; 4067 Context::GetContextMapIndexFromElementsKind(transitioned_kind);
4070 movq(map_in_out, FieldOperand(scratch, offset)); 4068 movq(map_in_out, Operand(scratch, Context::SlotOffset(trans_index)));
4071 } 4069 }
4072 4070
4073 4071
4074 void MacroAssembler::LoadInitialArrayMap( 4072 void MacroAssembler::LoadInitialArrayMap(
4075 Register function_in, Register scratch, 4073 Register function_in, Register scratch, Register map_out) {
4076 Register map_out, bool can_have_holes) {
4077 ASSERT(!function_in.is(map_out)); 4074 ASSERT(!function_in.is(map_out));
4078 Label done; 4075 Label done;
4079 movq(map_out, FieldOperand(function_in, 4076 movq(map_out, FieldOperand(function_in,
4080 JSFunction::kPrototypeOrInitialMapOffset)); 4077 JSFunction::kPrototypeOrInitialMapOffset));
4081 if (!FLAG_smi_only_arrays) { 4078 if (!FLAG_smi_only_arrays) {
4082 ElementsKind kind = can_have_holes ? FAST_HOLEY_ELEMENTS : FAST_ELEMENTS; 4079 LoadTransitionedArrayMapConditional(FAST_SMI_ONLY_ELEMENTS,
4083 LoadTransitionedArrayMapConditional(FAST_SMI_ELEMENTS, 4080 FAST_ELEMENTS,
4084 kind,
4085 map_out, 4081 map_out,
4086 scratch, 4082 scratch,
4087 &done); 4083 &done);
4088 } else if (can_have_holes) {
4089 LoadTransitionedArrayMapConditional(FAST_SMI_ELEMENTS,
4090 FAST_HOLEY_SMI_ELEMENTS,
4091 map_out,
4092 scratch,
4093 &done);
4094 } 4084 }
4095 bind(&done); 4085 bind(&done);
4096 } 4086 }
4097 4087
4098 #ifdef _WIN64 4088 #ifdef _WIN64
4099 static const int kRegisterPassedArguments = 4; 4089 static const int kRegisterPassedArguments = 4;
4100 #else 4090 #else
4101 static const int kRegisterPassedArguments = 6; 4091 static const int kRegisterPassedArguments = 6;
4102 #endif 4092 #endif
4103 4093
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
4446 bind(&check_prototype); 4436 bind(&check_prototype);
4447 movq(rcx, FieldOperand(rbx, Map::kPrototypeOffset)); 4437 movq(rcx, FieldOperand(rbx, Map::kPrototypeOffset));
4448 cmpq(rcx, null_value); 4438 cmpq(rcx, null_value);
4449 j(not_equal, &next); 4439 j(not_equal, &next);
4450 } 4440 }
4451 4441
4452 4442
4453 } } // namespace v8::internal 4443 } } // namespace v8::internal
4454 4444
4455 #endif // V8_TARGET_ARCH_X64 4445 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/macro-assembler-x64.h ('k') | src/x64/stub-cache-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698