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

Side by Side Diff: src/mips/code-stubs-mips.cc

Issue 211453002: MIPS: Refactor optimized in hydrogen only runtime functions. (Closed) Base URL: git://github.com/paul99/v8m-rb.git@gbl
Patch Set: Created 6 years, 9 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
« no previous file with comments | « no previous file | src/mips/full-codegen-mips.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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
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[] = { a0 }; 76 static Register registers[] = { a0 };
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[] = { a3, a2, a1 }; 87 static Register registers[] = { a3, a2, a1 };
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
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[] = { a2, a1, a0 }; 141 static Register registers[] = { a2, a1, a0 };
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[] = { a0 }; 152 static Register registers[] = { a0 };
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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 } 379 }
380 380
381 381
382 void StringAddStub::InitializeInterfaceDescriptor( 382 void StringAddStub::InitializeInterfaceDescriptor(
383 Isolate* isolate, 383 Isolate* isolate,
384 CodeStubInterfaceDescriptor* descriptor) { 384 CodeStubInterfaceDescriptor* descriptor) {
385 static Register registers[] = { a1, a0 }; 385 static Register registers[] = { a1, a0 };
386 descriptor->register_param_count_ = 2; 386 descriptor->register_param_count_ = 2;
387 descriptor->register_params_ = registers; 387 descriptor->register_params_ = registers;
388 descriptor->deoptimization_handler_ = 388 descriptor->deoptimization_handler_ =
389 Runtime::FunctionForId(Runtime::kStringAdd)->entry; 389 Runtime::FunctionForId(Runtime::kHiddenStringAdd)->entry;
390 } 390 }
391 391
392 392
393 void CallDescriptors::InitializeForIsolate(Isolate* isolate) { 393 void CallDescriptors::InitializeForIsolate(Isolate* isolate) {
394 { 394 {
395 CallInterfaceDescriptor* descriptor = 395 CallInterfaceDescriptor* descriptor =
396 isolate->call_descriptor(Isolate::ArgumentAdaptorCall); 396 isolate->call_descriptor(Isolate::ArgumentAdaptorCall);
397 static Register registers[] = { a1, // JSFunction 397 static Register registers[] = { a1, // JSFunction
398 cp, // context 398 cp, // context
399 a0, // actual number of arguments 399 a0, // actual number of arguments
(...skipping 2182 matching lines...) Expand 10 before | Expand all | Expand 10 after
2582 __ bind(&runtime); 2582 __ bind(&runtime);
2583 __ TailCallRuntime(Runtime::kNewStrictArgumentsFast, 3, 1); 2583 __ TailCallRuntime(Runtime::kNewStrictArgumentsFast, 3, 1);
2584 } 2584 }
2585 2585
2586 2586
2587 void RegExpExecStub::Generate(MacroAssembler* masm) { 2587 void RegExpExecStub::Generate(MacroAssembler* masm) {
2588 // Just jump directly to runtime if native RegExp is not selected at compile 2588 // Just jump directly to runtime if native RegExp is not selected at compile
2589 // time or if regexp entry in generated code is turned off runtime switch or 2589 // time or if regexp entry in generated code is turned off runtime switch or
2590 // at compilation. 2590 // at compilation.
2591 #ifdef V8_INTERPRETED_REGEXP 2591 #ifdef V8_INTERPRETED_REGEXP
2592 __ TailCallRuntime(Runtime::kRegExpExec, 4, 1); 2592 __ TailCallRuntime(Runtime::kHiddenRegExpExec, 4, 1);
2593 #else // V8_INTERPRETED_REGEXP 2593 #else // V8_INTERPRETED_REGEXP
2594 2594
2595 // Stack frame on entry. 2595 // Stack frame on entry.
2596 // sp[0]: last_match_info (expected JSArray) 2596 // sp[0]: last_match_info (expected JSArray)
2597 // sp[4]: previous index 2597 // sp[4]: previous index
2598 // sp[8]: subject string 2598 // sp[8]: subject string
2599 // sp[12]: JSRegExp object 2599 // sp[12]: JSRegExp object
2600 2600
2601 const int kLastMatchInfoOffset = 0 * kPointerSize; 2601 const int kLastMatchInfoOffset = 0 * kPointerSize;
2602 const int kPreviousIndexOffset = 1 * kPointerSize; 2602 const int kPreviousIndexOffset = 1 * kPointerSize;
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
2974 __ addiu(a0, a0, kPointerSize); // In branch delay slot. 2974 __ addiu(a0, a0, kPointerSize); // In branch delay slot.
2975 2975
2976 __ bind(&done); 2976 __ bind(&done);
2977 2977
2978 // Return last match info. 2978 // Return last match info.
2979 __ lw(v0, MemOperand(sp, kLastMatchInfoOffset)); 2979 __ lw(v0, MemOperand(sp, kLastMatchInfoOffset));
2980 __ DropAndRet(4); 2980 __ DropAndRet(4);
2981 2981
2982 // Do the runtime call to execute the regexp. 2982 // Do the runtime call to execute the regexp.
2983 __ bind(&runtime); 2983 __ bind(&runtime);
2984 __ TailCallRuntime(Runtime::kRegExpExec, 4, 1); 2984 __ TailCallRuntime(Runtime::kHiddenRegExpExec, 4, 1);
2985 2985
2986 // Deferred code for string handling. 2986 // Deferred code for string handling.
2987 // (6) Not a long external string? If yes, go to (8). 2987 // (6) Not a long external string? If yes, go to (8).
2988 __ bind(&not_seq_nor_cons); 2988 __ bind(&not_seq_nor_cons);
2989 // Go to (8). 2989 // Go to (8).
2990 __ Branch(&not_long_external, gt, a1, Operand(kExternalStringTag)); 2990 __ Branch(&not_long_external, gt, a1, Operand(kExternalStringTag));
2991 2991
2992 // (7) External string. Make it, offset-wise, look like a sequential string. 2992 // (7) External string. Make it, offset-wise, look like a sequential string.
2993 __ bind(&external_string); 2993 __ bind(&external_string);
2994 __ lw(a0, FieldMemOperand(subject, HeapObject::kMapOffset)); 2994 __ lw(a0, FieldMemOperand(subject, HeapObject::kMapOffset));
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
3381 // Otherwise, return to the fast path. 3381 // Otherwise, return to the fast path.
3382 __ Branch(&got_smi_index_); 3382 __ Branch(&got_smi_index_);
3383 3383
3384 // Call runtime. We get here when the receiver is a string and the 3384 // Call runtime. We get here when the receiver is a string and the
3385 // index is a number, but the code of getting the actual character 3385 // index is a number, but the code of getting the actual character
3386 // is too complex (e.g., when the string needs to be flattened). 3386 // is too complex (e.g., when the string needs to be flattened).
3387 __ bind(&call_runtime_); 3387 __ bind(&call_runtime_);
3388 call_helper.BeforeCall(masm); 3388 call_helper.BeforeCall(masm);
3389 __ sll(index_, index_, kSmiTagSize); 3389 __ sll(index_, index_, kSmiTagSize);
3390 __ Push(object_, index_); 3390 __ Push(object_, index_);
3391 __ CallRuntime(Runtime::kStringCharCodeAt, 2); 3391 __ CallRuntime(Runtime::kHiddenStringCharCodeAt, 2);
3392 3392
3393 __ Move(result_, v0); 3393 __ Move(result_, v0);
3394 3394
3395 call_helper.AfterCall(masm); 3395 call_helper.AfterCall(masm);
3396 __ jmp(&exit_); 3396 __ jmp(&exit_);
3397 3397
3398 __ Abort(kUnexpectedFallthroughFromCharCodeAtSlowCase); 3398 __ Abort(kUnexpectedFallthroughFromCharCodeAtSlowCase);
3399 } 3399 }
3400 3400
3401 3401
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
3816 StringHelper::GenerateCopyCharactersLong( 3816 StringHelper::GenerateCopyCharactersLong(
3817 masm, a1, t1, a2, a3, t0, t2, t3, t4, DEST_ALWAYS_ALIGNED); 3817 masm, a1, t1, a2, a3, t0, t2, t3, t4, DEST_ALWAYS_ALIGNED);
3818 3818
3819 __ bind(&return_v0); 3819 __ bind(&return_v0);
3820 Counters* counters = masm->isolate()->counters(); 3820 Counters* counters = masm->isolate()->counters();
3821 __ IncrementCounter(counters->sub_string_native(), 1, a3, t0); 3821 __ IncrementCounter(counters->sub_string_native(), 1, a3, t0);
3822 __ DropAndRet(3); 3822 __ DropAndRet(3);
3823 3823
3824 // Just jump to runtime to create the sub string. 3824 // Just jump to runtime to create the sub string.
3825 __ bind(&runtime); 3825 __ bind(&runtime);
3826 __ TailCallRuntime(Runtime::kSubString, 3, 1); 3826 __ TailCallRuntime(Runtime::kHiddenSubString, 3, 1);
3827 3827
3828 __ bind(&single_char); 3828 __ bind(&single_char);
3829 // v0: original string 3829 // v0: original string
3830 // a1: instance type 3830 // a1: instance type
3831 // a2: length 3831 // a2: length
3832 // a3: from index (untagged) 3832 // a3: from index (untagged)
3833 __ SmiTag(a3, a3); 3833 __ SmiTag(a3, a3);
3834 StringCharAtGenerator generator( 3834 StringCharAtGenerator generator(
3835 v0, a3, a2, v0, &runtime, &runtime, &runtime, STRING_INDEX_IS_NUMBER); 3835 v0, a3, a2, v0, &runtime, &runtime, &runtime, STRING_INDEX_IS_NUMBER);
3836 generator.GenerateFast(masm); 3836 generator.GenerateFast(masm);
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
3981 3981
3982 // Check that both objects are sequential ASCII strings. 3982 // Check that both objects are sequential ASCII strings.
3983 __ JumpIfNotBothSequentialAsciiStrings(a1, a0, a2, a3, &runtime); 3983 __ JumpIfNotBothSequentialAsciiStrings(a1, a0, a2, a3, &runtime);
3984 3984
3985 // Compare flat ASCII strings natively. Remove arguments from stack first. 3985 // Compare flat ASCII strings natively. Remove arguments from stack first.
3986 __ IncrementCounter(counters->string_compare_native(), 1, a2, a3); 3986 __ IncrementCounter(counters->string_compare_native(), 1, a2, a3);
3987 __ Addu(sp, sp, Operand(2 * kPointerSize)); 3987 __ Addu(sp, sp, Operand(2 * kPointerSize));
3988 GenerateCompareFlatAsciiStrings(masm, a1, a0, a2, a3, t0, t1); 3988 GenerateCompareFlatAsciiStrings(masm, a1, a0, a2, a3, t0, t1);
3989 3989
3990 __ bind(&runtime); 3990 __ bind(&runtime);
3991 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); 3991 __ TailCallRuntime(Runtime::kHiddenStringCompare, 2, 1);
3992 } 3992 }
3993 3993
3994 3994
3995 void ArrayPushStub::Generate(MacroAssembler* masm) { 3995 void ArrayPushStub::Generate(MacroAssembler* masm) {
3996 Register receiver = a0; 3996 Register receiver = a0;
3997 Register scratch = a1; 3997 Register scratch = a1;
3998 3998
3999 int argc = arguments_count(); 3999 int argc = arguments_count();
4000 4000
4001 if (argc == 0) { 4001 if (argc == 0) {
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
4492 StringCompareStub::GenerateCompareFlatAsciiStrings( 4492 StringCompareStub::GenerateCompareFlatAsciiStrings(
4493 masm, left, right, tmp1, tmp2, tmp3, tmp4); 4493 masm, left, right, tmp1, tmp2, tmp3, tmp4);
4494 } 4494 }
4495 4495
4496 // Handle more complex cases in runtime. 4496 // Handle more complex cases in runtime.
4497 __ bind(&runtime); 4497 __ bind(&runtime);
4498 __ Push(left, right); 4498 __ Push(left, right);
4499 if (equality) { 4499 if (equality) {
4500 __ TailCallRuntime(Runtime::kStringEquals, 2, 1); 4500 __ TailCallRuntime(Runtime::kStringEquals, 2, 1);
4501 } else { 4501 } else {
4502 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); 4502 __ TailCallRuntime(Runtime::kHiddenStringCompare, 2, 1);
4503 } 4503 }
4504 4504
4505 __ bind(&miss); 4505 __ bind(&miss);
4506 GenerateMiss(masm); 4506 GenerateMiss(masm);
4507 } 4507 }
4508 4508
4509 4509
4510 void ICCompareStub::GenerateObjects(MacroAssembler* masm) { 4510 void ICCompareStub::GenerateObjects(MacroAssembler* masm) {
4511 ASSERT(state_ == CompareIC::OBJECT); 4511 ASSERT(state_ == CompareIC::OBJECT);
4512 Label miss; 4512 Label miss;
(...skipping 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after
5637 MemOperand(fp, 6 * kPointerSize), 5637 MemOperand(fp, 6 * kPointerSize),
5638 NULL); 5638 NULL);
5639 } 5639 }
5640 5640
5641 5641
5642 #undef __ 5642 #undef __
5643 5643
5644 } } // namespace v8::internal 5644 } } // namespace v8::internal
5645 5645
5646 #endif // V8_TARGET_ARCH_MIPS 5646 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « no previous file | src/mips/full-codegen-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698