| 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 Runtime::FunctionForId(Runtime::kTransitionElementsKind)->entry; | 118 Runtime::FunctionForId(Runtime::kTransitionElementsKind)->entry; |
| 119 } | 119 } |
| 120 | 120 |
| 121 | 121 |
| 122 static void InitializeArrayConstructorDescriptor( | 122 static void InitializeArrayConstructorDescriptor( |
| 123 Isolate* isolate, | 123 Isolate* isolate, |
| 124 CodeStubInterfaceDescriptor* descriptor, | 124 CodeStubInterfaceDescriptor* descriptor, |
| 125 int constant_stack_parameter_count) { | 125 int constant_stack_parameter_count) { |
| 126 // register state | 126 // register state |
| 127 // rax -- number of arguments | 127 // rax -- number of arguments |
| 128 // rdi -- function |
| 128 // rbx -- type info cell with elements kind | 129 // rbx -- type info cell with elements kind |
| 129 static Register registers[] = { rbx }; | 130 static Register registers[] = { rdi, rbx }; |
| 130 descriptor->register_param_count_ = 1; | 131 descriptor->register_param_count_ = 2; |
| 131 if (constant_stack_parameter_count != 0) { | 132 if (constant_stack_parameter_count != 0) { |
| 132 // stack param count needs (constructor pointer, and single argument) | 133 // stack param count needs (constructor pointer, and single argument) |
| 133 descriptor->stack_parameter_count_ = &rax; | 134 descriptor->stack_parameter_count_ = &rax; |
| 134 } | 135 } |
| 135 descriptor->hint_stack_parameter_count_ = constant_stack_parameter_count; | 136 descriptor->hint_stack_parameter_count_ = constant_stack_parameter_count; |
| 136 descriptor->register_params_ = registers; | 137 descriptor->register_params_ = registers; |
| 137 descriptor->function_mode_ = JS_FUNCTION_STUB_MODE; | 138 descriptor->function_mode_ = JS_FUNCTION_STUB_MODE; |
| 138 descriptor->deoptimization_handler_ = | 139 descriptor->deoptimization_handler_ = |
| 139 FUNCTION_ADDR(ArrayConstructor_StubFailure); | 140 FUNCTION_ADDR(ArrayConstructor_StubFailure); |
| 140 } | 141 } |
| (...skipping 6800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6941 __ Cmp(FieldOperand(rbx, 0), global_property_cell_map); | 6942 __ Cmp(FieldOperand(rbx, 0), global_property_cell_map); |
| 6942 __ Assert(equal, "Expected property cell in register rbx"); | 6943 __ Assert(equal, "Expected property cell in register rbx"); |
| 6943 __ bind(&okay_here); | 6944 __ bind(&okay_here); |
| 6944 } | 6945 } |
| 6945 | 6946 |
| 6946 if (FLAG_optimize_constructed_arrays) { | 6947 if (FLAG_optimize_constructed_arrays) { |
| 6947 Label no_info, switch_ready; | 6948 Label no_info, switch_ready; |
| 6948 // Get the elements kind and case on that. | 6949 // Get the elements kind and case on that. |
| 6949 __ Cmp(rbx, undefined_sentinel); | 6950 __ Cmp(rbx, undefined_sentinel); |
| 6950 __ j(equal, &no_info); | 6951 __ j(equal, &no_info); |
| 6951 __ movq(rdx, FieldOperand(rbx, kPointerSize)); | 6952 __ movq(rdx, FieldOperand(rbx, JSGlobalPropertyCell::kValueOffset)); |
| 6952 | 6953 __ JumpIfNotSmi(rdx, &no_info); |
| 6953 // There is no info if the call site went megamorphic either | |
| 6954 | |
| 6955 // TODO(mvstanton): Really? I thought if it was the array function that | |
| 6956 // the cell wouldn't get stamped as megamorphic. | |
| 6957 __ Cmp(rdx, TypeFeedbackCells::MegamorphicSentinel(masm->isolate())); | |
| 6958 __ j(equal, &no_info); | |
| 6959 __ SmiToInteger32(rdx, rdx); | 6954 __ SmiToInteger32(rdx, rdx); |
| 6960 __ jmp(&switch_ready); | 6955 __ jmp(&switch_ready); |
| 6961 __ bind(&no_info); | 6956 __ bind(&no_info); |
| 6962 __ movq(rdx, Immediate(GetInitialFastElementsKind())); | 6957 __ movq(rdx, Immediate(GetInitialFastElementsKind())); |
| 6963 __ bind(&switch_ready); | 6958 __ bind(&switch_ready); |
| 6964 | 6959 |
| 6965 if (argument_count_ == ANY) { | 6960 if (argument_count_ == ANY) { |
| 6966 Label not_zero_case, not_one_case; | 6961 Label not_zero_case, not_one_case; |
| 6967 __ testq(rax, rax); | 6962 __ testq(rax, rax); |
| 6968 __ j(not_zero, ¬_zero_case); | 6963 __ j(not_zero, ¬_zero_case); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 6997 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET); | 6992 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET); |
| 6998 } | 6993 } |
| 6999 } | 6994 } |
| 7000 | 6995 |
| 7001 | 6996 |
| 7002 #undef __ | 6997 #undef __ |
| 7003 | 6998 |
| 7004 } } // namespace v8::internal | 6999 } } // namespace v8::internal |
| 7005 | 7000 |
| 7006 #endif // V8_TARGET_ARCH_X64 | 7001 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |