| 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 #include "src/code-stubs.h" | 5 #include "src/code-stubs.h" |
| 6 | 6 |
| 7 #include <sstream> | 7 #include <sstream> |
| 8 | 8 |
| 9 #include "src/ast/ast.h" | 9 #include "src/ast/ast.h" |
| 10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
| (...skipping 2674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2685 StoreFastElementStub(isolate, false, FAST_HOLEY_ELEMENTS, | 2685 StoreFastElementStub(isolate, false, FAST_HOLEY_ELEMENTS, |
| 2686 STORE_AND_GROW_NO_TRANSITION).GetCode(); | 2686 STORE_AND_GROW_NO_TRANSITION).GetCode(); |
| 2687 for (int i = FIRST_FAST_ELEMENTS_KIND; i <= LAST_FAST_ELEMENTS_KIND; i++) { | 2687 for (int i = FIRST_FAST_ELEMENTS_KIND; i <= LAST_FAST_ELEMENTS_KIND; i++) { |
| 2688 ElementsKind kind = static_cast<ElementsKind>(i); | 2688 ElementsKind kind = static_cast<ElementsKind>(i); |
| 2689 StoreFastElementStub(isolate, true, kind, STANDARD_STORE).GetCode(); | 2689 StoreFastElementStub(isolate, true, kind, STANDARD_STORE).GetCode(); |
| 2690 StoreFastElementStub(isolate, true, kind, STORE_AND_GROW_NO_TRANSITION) | 2690 StoreFastElementStub(isolate, true, kind, STORE_AND_GROW_NO_TRANSITION) |
| 2691 .GetCode(); | 2691 .GetCode(); |
| 2692 } | 2692 } |
| 2693 } | 2693 } |
| 2694 | 2694 |
| 2695 void ArrayConstructorStub::PrintName(std::ostream& os) const { // NOLINT | |
| 2696 os << "ArrayConstructorStub"; | |
| 2697 switch (argument_count()) { | |
| 2698 case ANY: | |
| 2699 os << "_Any"; | |
| 2700 break; | |
| 2701 case NONE: | |
| 2702 os << "_None"; | |
| 2703 break; | |
| 2704 case ONE: | |
| 2705 os << "_One"; | |
| 2706 break; | |
| 2707 case MORE_THAN_ONE: | |
| 2708 os << "_More_Than_One"; | |
| 2709 break; | |
| 2710 } | |
| 2711 return; | |
| 2712 } | |
| 2713 | |
| 2714 | |
| 2715 bool ToBooleanICStub::UpdateStatus(Handle<Object> object) { | 2695 bool ToBooleanICStub::UpdateStatus(Handle<Object> object) { |
| 2716 Types new_types = types(); | 2696 Types new_types = types(); |
| 2717 Types old_types = new_types; | 2697 Types old_types = new_types; |
| 2718 bool to_boolean_value = new_types.UpdateStatus(isolate(), object); | 2698 bool to_boolean_value = new_types.UpdateStatus(isolate(), object); |
| 2719 TraceTransition(old_types, new_types); | 2699 TraceTransition(old_types, new_types); |
| 2720 set_sub_minor_key(TypesBits::update(sub_minor_key(), new_types.ToIntegral())); | 2700 set_sub_minor_key(TypesBits::update(sub_minor_key(), new_types.ToIntegral())); |
| 2721 return to_boolean_value; | 2701 return to_boolean_value; |
| 2722 } | 2702 } |
| 2723 | 2703 |
| 2724 void ToBooleanICStub::PrintState(std::ostream& os) const { // NOLINT | 2704 void ToBooleanICStub::PrintState(std::ostream& os) const { // NOLINT |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2969 // allocation path (zero, since all the stubs inputs are in registers) and | 2949 // allocation path (zero, since all the stubs inputs are in registers) and |
| 2970 // when the call happens (it would be two in the tail call case due to the | 2950 // when the call happens (it would be two in the tail call case due to the |
| 2971 // tail call pushing the arguments on the stack for the runtime call). By not | 2951 // tail call pushing the arguments on the stack for the runtime call). By not |
| 2972 // tail-calling, the runtime call case also has zero arguments on the stack | 2952 // tail-calling, the runtime call case also has zero arguments on the stack |
| 2973 // for the stub frame. | 2953 // for the stub frame. |
| 2974 assembler->Return(assembler->CallRuntime(Runtime::kGrowArrayElements, context, | 2954 assembler->Return(assembler->CallRuntime(Runtime::kGrowArrayElements, context, |
| 2975 object, key)); | 2955 object, key)); |
| 2976 } | 2956 } |
| 2977 | 2957 |
| 2978 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate) | 2958 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate) |
| 2979 : PlatformCodeStub(isolate) { | 2959 : PlatformCodeStub(isolate) {} |
| 2980 minor_key_ = ArgumentCountBits::encode(ANY); | |
| 2981 } | |
| 2982 | |
| 2983 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate, | |
| 2984 int argument_count) | |
| 2985 : PlatformCodeStub(isolate) { | |
| 2986 if (argument_count == 0) { | |
| 2987 minor_key_ = ArgumentCountBits::encode(NONE); | |
| 2988 } else if (argument_count == 1) { | |
| 2989 minor_key_ = ArgumentCountBits::encode(ONE); | |
| 2990 } else if (argument_count >= 2) { | |
| 2991 minor_key_ = ArgumentCountBits::encode(MORE_THAN_ONE); | |
| 2992 } else { | |
| 2993 UNREACHABLE(); | |
| 2994 } | |
| 2995 } | |
| 2996 | 2960 |
| 2997 InternalArrayConstructorStub::InternalArrayConstructorStub(Isolate* isolate) | 2961 InternalArrayConstructorStub::InternalArrayConstructorStub(Isolate* isolate) |
| 2998 : PlatformCodeStub(isolate) {} | 2962 : PlatformCodeStub(isolate) {} |
| 2999 | 2963 |
| 3000 Representation RepresentationFromMachineType(MachineType type) { | 2964 Representation RepresentationFromMachineType(MachineType type) { |
| 3001 if (type == MachineType::Int32()) { | 2965 if (type == MachineType::Int32()) { |
| 3002 return Representation::Integer32(); | 2966 return Representation::Integer32(); |
| 3003 } | 2967 } |
| 3004 | 2968 |
| 3005 if (type == MachineType::TaggedSigned()) { | 2969 if (type == MachineType::TaggedSigned()) { |
| 3006 return Representation::Smi(); | 2970 return Representation::Smi(); |
| 3007 } | 2971 } |
| 3008 | 2972 |
| 3009 if (type == MachineType::Pointer()) { | 2973 if (type == MachineType::Pointer()) { |
| 3010 return Representation::External(); | 2974 return Representation::External(); |
| 3011 } | 2975 } |
| 3012 | 2976 |
| 3013 return Representation::Tagged(); | 2977 return Representation::Tagged(); |
| 3014 } | 2978 } |
| 3015 | 2979 |
| 3016 } // namespace internal | 2980 } // namespace internal |
| 3017 } // namespace v8 | 2981 } // namespace v8 |
| OLD | NEW |