OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 } | 70 } |
71 | 71 |
72 | 72 |
73 void NumberToStringStub::InitializeInterfaceDescriptor( | 73 void NumberToStringStub::InitializeInterfaceDescriptor( |
74 Isolate* isolate, | 74 Isolate* isolate, |
75 CodeStubInterfaceDescriptor* descriptor) { | 75 CodeStubInterfaceDescriptor* descriptor) { |
76 static Register registers[] = { rax }; | 76 static Register registers[] = { rax }; |
77 descriptor->register_param_count_ = 1; | 77 descriptor->register_param_count_ = 1; |
78 descriptor->register_params_ = registers; | 78 descriptor->register_params_ = registers; |
79 descriptor->deoptimization_handler_ = | 79 descriptor->deoptimization_handler_ = |
80 Runtime::FunctionForId(Runtime::kNumberToString)->entry; | 80 Runtime::FunctionForId(Runtime::kHiddenNumberToString)->entry; |
81 } | 81 } |
82 | 82 |
83 | 83 |
84 void FastCloneShallowArrayStub::InitializeInterfaceDescriptor( | 84 void FastCloneShallowArrayStub::InitializeInterfaceDescriptor( |
85 Isolate* isolate, | 85 Isolate* isolate, |
86 CodeStubInterfaceDescriptor* descriptor) { | 86 CodeStubInterfaceDescriptor* descriptor) { |
87 static Register registers[] = { rax, rbx, rcx }; | 87 static Register registers[] = { rax, rbx, rcx }; |
88 descriptor->register_param_count_ = 3; | 88 descriptor->register_param_count_ = 3; |
89 descriptor->register_params_ = registers; | 89 descriptor->register_params_ = registers; |
90 descriptor->deoptimization_handler_ = | 90 descriptor->deoptimization_handler_ = |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 } | 135 } |
136 | 136 |
137 | 137 |
138 void RegExpConstructResultStub::InitializeInterfaceDescriptor( | 138 void RegExpConstructResultStub::InitializeInterfaceDescriptor( |
139 Isolate* isolate, | 139 Isolate* isolate, |
140 CodeStubInterfaceDescriptor* descriptor) { | 140 CodeStubInterfaceDescriptor* descriptor) { |
141 static Register registers[] = { rcx, rbx, rax }; | 141 static Register registers[] = { rcx, rbx, rax }; |
142 descriptor->register_param_count_ = 3; | 142 descriptor->register_param_count_ = 3; |
143 descriptor->register_params_ = registers; | 143 descriptor->register_params_ = registers; |
144 descriptor->deoptimization_handler_ = | 144 descriptor->deoptimization_handler_ = |
145 Runtime::FunctionForId(Runtime::kRegExpConstructResult)->entry; | 145 Runtime::FunctionForId(Runtime::kHiddenRegExpConstructResult)->entry; |
146 } | 146 } |
147 | 147 |
148 | 148 |
149 void LoadFieldStub::InitializeInterfaceDescriptor( | 149 void LoadFieldStub::InitializeInterfaceDescriptor( |
150 Isolate* isolate, | 150 Isolate* isolate, |
151 CodeStubInterfaceDescriptor* descriptor) { | 151 CodeStubInterfaceDescriptor* descriptor) { |
152 static Register registers[] = { rax }; | 152 static Register registers[] = { rax }; |
153 descriptor->register_param_count_ = 1; | 153 descriptor->register_param_count_ = 1; |
154 descriptor->register_params_ = registers; | 154 descriptor->register_params_ = registers; |
155 descriptor->deoptimization_handler_ = NULL; | 155 descriptor->deoptimization_handler_ = NULL; |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 } | 378 } |
379 | 379 |
380 | 380 |
381 void StringAddStub::InitializeInterfaceDescriptor( | 381 void StringAddStub::InitializeInterfaceDescriptor( |
382 Isolate* isolate, | 382 Isolate* isolate, |
383 CodeStubInterfaceDescriptor* descriptor) { | 383 CodeStubInterfaceDescriptor* descriptor) { |
384 static Register registers[] = { rdx, rax }; | 384 static Register registers[] = { rdx, rax }; |
385 descriptor->register_param_count_ = 2; | 385 descriptor->register_param_count_ = 2; |
386 descriptor->register_params_ = registers; | 386 descriptor->register_params_ = registers; |
387 descriptor->deoptimization_handler_ = | 387 descriptor->deoptimization_handler_ = |
388 Runtime::FunctionForId(Runtime::kStringAdd)->entry; | 388 Runtime::FunctionForId(Runtime::kHiddenStringAdd)->entry; |
389 } | 389 } |
390 | 390 |
391 | 391 |
392 void CallDescriptors::InitializeForIsolate(Isolate* isolate) { | 392 void CallDescriptors::InitializeForIsolate(Isolate* isolate) { |
393 { | 393 { |
394 CallInterfaceDescriptor* descriptor = | 394 CallInterfaceDescriptor* descriptor = |
395 isolate->call_descriptor(Isolate::ArgumentAdaptorCall); | 395 isolate->call_descriptor(Isolate::ArgumentAdaptorCall); |
396 static Register registers[] = { rdi, // JSFunction | 396 static Register registers[] = { rdi, // JSFunction |
397 rsi, // context | 397 rsi, // context |
398 rax, // actual number of arguments | 398 rax, // actual number of arguments |
(...skipping 1328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1727 __ CompareRoot(rax, Heap::kTerminationExceptionRootIndex); | 1727 __ CompareRoot(rax, Heap::kTerminationExceptionRootIndex); |
1728 Label termination_exception; | 1728 Label termination_exception; |
1729 __ j(equal, &termination_exception, Label::kNear); | 1729 __ j(equal, &termination_exception, Label::kNear); |
1730 __ Throw(rax); | 1730 __ Throw(rax); |
1731 | 1731 |
1732 __ bind(&termination_exception); | 1732 __ bind(&termination_exception); |
1733 __ ThrowUncatchable(rax); | 1733 __ ThrowUncatchable(rax); |
1734 | 1734 |
1735 // Do the runtime call to execute the regexp. | 1735 // Do the runtime call to execute the regexp. |
1736 __ bind(&runtime); | 1736 __ bind(&runtime); |
1737 __ TailCallRuntime(Runtime::kRegExpExec, 4, 1); | 1737 __ TailCallRuntime(Runtime::kHiddenRegExpExec, 4, 1); |
1738 | 1738 |
1739 // Deferred code for string handling. | 1739 // Deferred code for string handling. |
1740 // (7) Not a long external string? If yes, go to (10). | 1740 // (7) Not a long external string? If yes, go to (10). |
1741 __ bind(¬_seq_nor_cons); | 1741 __ bind(¬_seq_nor_cons); |
1742 // Compare flags are still set from (3). | 1742 // Compare flags are still set from (3). |
1743 __ j(greater, ¬_long_external, Label::kNear); // Go to (10). | 1743 __ j(greater, ¬_long_external, Label::kNear); // Go to (10). |
1744 | 1744 |
1745 // (8) External string. Short external strings have been ruled out. | 1745 // (8) External string. Short external strings have been ruled out. |
1746 __ bind(&external_string); | 1746 __ bind(&external_string); |
1747 __ movp(rbx, FieldOperand(rdi, HeapObject::kMapOffset)); | 1747 __ movp(rbx, FieldOperand(rdi, HeapObject::kMapOffset)); |
(...skipping 1279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3027 __ jmp(&got_smi_index_); | 3027 __ jmp(&got_smi_index_); |
3028 | 3028 |
3029 // Call runtime. We get here when the receiver is a string and the | 3029 // Call runtime. We get here when the receiver is a string and the |
3030 // index is a number, but the code of getting the actual character | 3030 // index is a number, but the code of getting the actual character |
3031 // is too complex (e.g., when the string needs to be flattened). | 3031 // is too complex (e.g., when the string needs to be flattened). |
3032 __ bind(&call_runtime_); | 3032 __ bind(&call_runtime_); |
3033 call_helper.BeforeCall(masm); | 3033 call_helper.BeforeCall(masm); |
3034 __ Push(object_); | 3034 __ Push(object_); |
3035 __ Integer32ToSmi(index_, index_); | 3035 __ Integer32ToSmi(index_, index_); |
3036 __ Push(index_); | 3036 __ Push(index_); |
3037 __ CallRuntime(Runtime::kStringCharCodeAt, 2); | 3037 __ CallRuntime(Runtime::kHiddenStringCharCodeAt, 2); |
3038 if (!result_.is(rax)) { | 3038 if (!result_.is(rax)) { |
3039 __ movp(result_, rax); | 3039 __ movp(result_, rax); |
3040 } | 3040 } |
3041 call_helper.AfterCall(masm); | 3041 call_helper.AfterCall(masm); |
3042 __ jmp(&exit_); | 3042 __ jmp(&exit_); |
3043 | 3043 |
3044 __ Abort(kUnexpectedFallthroughFromCharCodeAtSlowCase); | 3044 __ Abort(kUnexpectedFallthroughFromCharCodeAtSlowCase); |
3045 } | 3045 } |
3046 | 3046 |
3047 | 3047 |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3402 // rdi: first character of result | 3402 // rdi: first character of result |
3403 // rsi: character of sub string start | 3403 // rsi: character of sub string start |
3404 // r14: original value of rsi | 3404 // r14: original value of rsi |
3405 StringHelper::GenerateCopyCharactersREP(masm, rdi, rsi, rcx, false); | 3405 StringHelper::GenerateCopyCharactersREP(masm, rdi, rsi, rcx, false); |
3406 __ movp(rsi, r14); // Restore esi. | 3406 __ movp(rsi, r14); // Restore esi. |
3407 __ IncrementCounter(counters->sub_string_native(), 1); | 3407 __ IncrementCounter(counters->sub_string_native(), 1); |
3408 __ ret(SUB_STRING_ARGUMENT_COUNT * kPointerSize); | 3408 __ ret(SUB_STRING_ARGUMENT_COUNT * kPointerSize); |
3409 | 3409 |
3410 // Just jump to runtime to create the sub string. | 3410 // Just jump to runtime to create the sub string. |
3411 __ bind(&runtime); | 3411 __ bind(&runtime); |
3412 __ TailCallRuntime(Runtime::kSubString, 3, 1); | 3412 __ TailCallRuntime(Runtime::kHiddenSubString, 3, 1); |
3413 | 3413 |
3414 __ bind(&single_char); | 3414 __ bind(&single_char); |
3415 // rax: string | 3415 // rax: string |
3416 // rbx: instance type | 3416 // rbx: instance type |
3417 // rcx: sub string length (smi) | 3417 // rcx: sub string length (smi) |
3418 // rdx: from index (smi) | 3418 // rdx: from index (smi) |
3419 StringCharAtGenerator generator( | 3419 StringCharAtGenerator generator( |
3420 rax, rdx, rcx, rax, &runtime, &runtime, &runtime, STRING_INDEX_IS_NUMBER); | 3420 rax, rdx, rcx, rax, &runtime, &runtime, &runtime, STRING_INDEX_IS_NUMBER); |
3421 generator.GenerateFast(masm); | 3421 generator.GenerateFast(masm); |
3422 __ ret(SUB_STRING_ARGUMENT_COUNT * kPointerSize); | 3422 __ ret(SUB_STRING_ARGUMENT_COUNT * kPointerSize); |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3599 __ IncrementCounter(counters->string_compare_native(), 1); | 3599 __ IncrementCounter(counters->string_compare_native(), 1); |
3600 // Drop arguments from the stack | 3600 // Drop arguments from the stack |
3601 __ PopReturnAddressTo(rcx); | 3601 __ PopReturnAddressTo(rcx); |
3602 __ addp(rsp, Immediate(2 * kPointerSize)); | 3602 __ addp(rsp, Immediate(2 * kPointerSize)); |
3603 __ PushReturnAddressFrom(rcx); | 3603 __ PushReturnAddressFrom(rcx); |
3604 GenerateCompareFlatAsciiStrings(masm, rdx, rax, rcx, rbx, rdi, r8); | 3604 GenerateCompareFlatAsciiStrings(masm, rdx, rax, rcx, rbx, rdi, r8); |
3605 | 3605 |
3606 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) | 3606 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) |
3607 // tagged as a small integer. | 3607 // tagged as a small integer. |
3608 __ bind(&runtime); | 3608 __ bind(&runtime); |
3609 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); | 3609 __ TailCallRuntime(Runtime::kHiddenStringCompare, 2, 1); |
3610 } | 3610 } |
3611 | 3611 |
3612 | 3612 |
3613 void ArrayPushStub::Generate(MacroAssembler* masm) { | 3613 void ArrayPushStub::Generate(MacroAssembler* masm) { |
3614 int argc = arguments_count(); | 3614 int argc = arguments_count(); |
3615 | 3615 |
3616 StackArgumentsAccessor args(rsp, argc); | 3616 StackArgumentsAccessor args(rsp, argc); |
3617 if (argc == 0) { | 3617 if (argc == 0) { |
3618 // Noop, return the length. | 3618 // Noop, return the length. |
3619 __ movp(rax, FieldOperand(rdx, JSArray::kLengthOffset)); | 3619 __ movp(rax, FieldOperand(rdx, JSArray::kLengthOffset)); |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4094 | 4094 |
4095 // Handle more complex cases in runtime. | 4095 // Handle more complex cases in runtime. |
4096 __ bind(&runtime); | 4096 __ bind(&runtime); |
4097 __ PopReturnAddressTo(tmp1); | 4097 __ PopReturnAddressTo(tmp1); |
4098 __ Push(left); | 4098 __ Push(left); |
4099 __ Push(right); | 4099 __ Push(right); |
4100 __ PushReturnAddressFrom(tmp1); | 4100 __ PushReturnAddressFrom(tmp1); |
4101 if (equality) { | 4101 if (equality) { |
4102 __ TailCallRuntime(Runtime::kStringEquals, 2, 1); | 4102 __ TailCallRuntime(Runtime::kStringEquals, 2, 1); |
4103 } else { | 4103 } else { |
4104 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); | 4104 __ TailCallRuntime(Runtime::kHiddenStringCompare, 2, 1); |
4105 } | 4105 } |
4106 | 4106 |
4107 __ bind(&miss); | 4107 __ bind(&miss); |
4108 GenerateMiss(masm); | 4108 GenerateMiss(masm); |
4109 } | 4109 } |
4110 | 4110 |
4111 | 4111 |
4112 void ICCompareStub::GenerateObjects(MacroAssembler* masm) { | 4112 void ICCompareStub::GenerateObjects(MacroAssembler* masm) { |
4113 ASSERT(state_ == CompareIC::OBJECT); | 4113 ASSERT(state_ == CompareIC::OBJECT); |
4114 Label miss; | 4114 Label miss; |
(...skipping 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5214 return_value_operand, | 5214 return_value_operand, |
5215 NULL); | 5215 NULL); |
5216 } | 5216 } |
5217 | 5217 |
5218 | 5218 |
5219 #undef __ | 5219 #undef __ |
5220 | 5220 |
5221 } } // namespace v8::internal | 5221 } } // namespace v8::internal |
5222 | 5222 |
5223 #endif // V8_TARGET_ARCH_X64 | 5223 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |