Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/globals.h" | 5 #include "vm/globals.h" |
| 6 #if defined(TARGET_ARCH_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
| 7 | 7 |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/code_generator.h" | 9 #include "vm/code_generator.h" |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 74 // bits kClosureFunctionBit and kInstanceFunctionBit in argc_tag_. | 74 // bits kClosureFunctionBit and kInstanceFunctionBit in argc_tag_. |
| 75 ASSERT(argc_tag_offset == 1 * kWordSize); | 75 ASSERT(argc_tag_offset == 1 * kWordSize); |
| 76 __ mov(A1, S4); // Set argc in NativeArguments. | 76 __ mov(A1, S4); // Set argc in NativeArguments. |
| 77 | 77 |
| 78 ASSERT(argv_offset == 2 * kWordSize); | 78 ASSERT(argv_offset == 2 * kWordSize); |
| 79 __ sll(A2, S4, 2); | 79 __ sll(A2, S4, 2); |
| 80 __ addu(A2, FP, A2); // Compute argv. | 80 __ addu(A2, FP, A2); // Compute argv. |
| 81 __ addiu(A2, A2, Immediate(kWordSize)); // Set argv in NativeArguments. | 81 __ addiu(A2, A2, Immediate(kWordSize)); // Set argv in NativeArguments. |
| 82 | 82 |
| 83 ASSERT(retval_offset == 3 * kWordSize); | 83 ASSERT(retval_offset == 3 * kWordSize); |
| 84 __ addiu(A3, A2, Immediate(kWordSize)); // Retval is next to 1st argument. | |
| 85 | 84 |
| 86 // Call runtime or redirection via simulator. | 85 // Call runtime or redirection via simulator. |
| 87 __ jalr(S5); | 86 __ jalr(S5); |
| 87 // Retval is next to 1st argument. | |
| 88 __ delay_slot()->addiu(A3, A2, Immediate(kWordSize)); | |
| 88 __ TraceSimMsg("CallToRuntimeStub return"); | 89 __ TraceSimMsg("CallToRuntimeStub return"); |
| 89 | 90 |
| 90 // Reset exit frame information in Isolate structure. | 91 // Reset exit frame information in Isolate structure. |
| 91 __ sw(ZR, Address(CTX, Isolate::top_exit_frame_info_offset())); | 92 __ sw(ZR, Address(CTX, Isolate::top_exit_frame_info_offset())); |
| 92 | 93 |
| 93 // Load Context pointer from Isolate structure into A2. | 94 // Load Context pointer from Isolate structure into A2. |
| 94 __ lw(A2, Address(CTX, Isolate::top_context_offset())); | 95 __ lw(A2, Address(CTX, Isolate::top_context_offset())); |
| 95 | 96 |
| 96 // Reset Context pointer in Isolate structure. | 97 // Reset Context pointer in Isolate structure. |
| 97 __ LoadImmediate(A3, reinterpret_cast<intptr_t>(Object::null())); | 98 __ LoadImmediate(A3, reinterpret_cast<intptr_t>(Object::null())); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 168 | 169 |
| 169 // TODO(regis): Should we pass the structure by value as in runtime calls? | 170 // TODO(regis): Should we pass the structure by value as in runtime calls? |
| 170 // It would require changing Dart API for native functions. | 171 // It would require changing Dart API for native functions. |
| 171 // For now, space is reserved on the stack and we pass a pointer to it. | 172 // For now, space is reserved on the stack and we pass a pointer to it. |
| 172 __ addiu(SP, SP, Immediate(-4 * kWordSize)); | 173 __ addiu(SP, SP, Immediate(-4 * kWordSize)); |
| 173 __ sw(A3, Address(SP, 3 * kWordSize)); | 174 __ sw(A3, Address(SP, 3 * kWordSize)); |
| 174 __ sw(A2, Address(SP, 2 * kWordSize)); | 175 __ sw(A2, Address(SP, 2 * kWordSize)); |
| 175 __ sw(A1, Address(SP, 1 * kWordSize)); | 176 __ sw(A1, Address(SP, 1 * kWordSize)); |
| 176 __ sw(A0, Address(SP, 0 * kWordSize)); | 177 __ sw(A0, Address(SP, 0 * kWordSize)); |
| 177 | 178 |
| 178 __ mov(A0, SP); // Pass the pointer to the NativeArguments. | |
| 179 | |
| 180 // Call native function or redirection via simulator. | 179 // Call native function or redirection via simulator. |
| 181 __ jalr(T5); | 180 __ jalr(T5); |
| 181 __ delay_slot()->mov(A0, SP); // Pass the pointer to the NativeArguments. | |
| 182 __ TraceSimMsg("CallNativeCFunctionStub return"); | 182 __ TraceSimMsg("CallNativeCFunctionStub return"); |
| 183 | 183 |
| 184 // Reset exit frame information in Isolate structure. | 184 // Reset exit frame information in Isolate structure. |
| 185 __ sw(ZR, Address(CTX, Isolate::top_exit_frame_info_offset())); | 185 __ sw(ZR, Address(CTX, Isolate::top_exit_frame_info_offset())); |
| 186 | 186 |
| 187 // Load Context pointer from Isolate structure into A2. | 187 // Load Context pointer from Isolate structure into A2. |
| 188 __ lw(A2, Address(CTX, Isolate::top_context_offset())); | 188 __ lw(A2, Address(CTX, Isolate::top_context_offset())); |
| 189 | 189 |
| 190 // Reset Context pointer in Isolate structure. | 190 // Reset Context pointer in Isolate structure. |
| 191 __ LoadImmediate(A3, reinterpret_cast<intptr_t>(Object::null())); | 191 __ LoadImmediate(A3, reinterpret_cast<intptr_t>(Object::null())); |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 221 __ lw(T0, Address(SP, 0 * kWordSize)); | 221 __ lw(T0, Address(SP, 0 * kWordSize)); |
| 222 __ lw(S4, Address(SP, 1 * kWordSize)); | 222 __ lw(S4, Address(SP, 1 * kWordSize)); |
| 223 __ addiu(SP, SP, Immediate(2 * kWordSize)); | 223 __ addiu(SP, SP, Immediate(2 * kWordSize)); |
| 224 | 224 |
| 225 // Remove the stub frame as we are about to jump to the dart function. | 225 // Remove the stub frame as we are about to jump to the dart function. |
| 226 __ LeaveStubFrame(); | 226 __ LeaveStubFrame(); |
| 227 | 227 |
| 228 __ lw(T0, FieldAddress(T0, Code::instructions_offset())); | 228 __ lw(T0, FieldAddress(T0, Code::instructions_offset())); |
| 229 __ AddImmediate(T0, Instructions::HeaderSize() - kHeapObjectTag); | 229 __ AddImmediate(T0, Instructions::HeaderSize() - kHeapObjectTag); |
| 230 __ jr(T0); | 230 __ jr(T0); |
| 231 __ delay_slot()->LeaveStubFrameSPRestore(); | |
| 231 } | 232 } |
| 232 | 233 |
| 233 | 234 |
| 234 // Called from a static call only when an invalid code has been entered | 235 // Called from a static call only when an invalid code has been entered |
| 235 // (invalid because its function was optimized or deoptimized). | 236 // (invalid because its function was optimized or deoptimized). |
| 236 // S4: arguments descriptor array. | 237 // S4: arguments descriptor array. |
| 237 void StubCode::GenerateFixCallersTargetStub(Assembler* assembler) { | 238 void StubCode::GenerateFixCallersTargetStub(Assembler* assembler) { |
| 238 // Create a stub frame as we are pushing some objects on the stack before | 239 // Create a stub frame as we are pushing some objects on the stack before |
| 239 // calling into the runtime. | 240 // calling into the runtime. |
| 240 __ EnterStubFrame(); | 241 __ EnterStubFrame(); |
| 241 // Setup space on stack for return value and preserve arguments descriptor. | 242 // Setup space on stack for return value and preserve arguments descriptor. |
| 242 __ LoadImmediate(T0, reinterpret_cast<intptr_t>(Object::null())); | 243 __ LoadImmediate(T0, reinterpret_cast<intptr_t>(Object::null())); |
| 243 __ addiu(SP, SP, Immediate(-2 * kWordSize)); | 244 __ addiu(SP, SP, Immediate(-2 * kWordSize)); |
| 244 __ sw(S4, Address(SP, 1 * kWordSize)); | 245 __ sw(S4, Address(SP, 1 * kWordSize)); |
| 245 __ sw(T0, Address(SP, 0 * kWordSize)); | 246 __ sw(T0, Address(SP, 0 * kWordSize)); |
| 246 __ CallRuntime(kFixCallersTargetRuntimeEntry); | 247 __ CallRuntime(kFixCallersTargetRuntimeEntry); |
| 247 // Get Code object result and restore arguments descriptor array. | 248 // Get Code object result and restore arguments descriptor array. |
| 248 __ lw(T0, Address(SP, 0 * kWordSize)); | 249 __ lw(T0, Address(SP, 0 * kWordSize)); |
| 249 __ lw(S4, Address(SP, 1 * kWordSize)); | 250 __ lw(S4, Address(SP, 1 * kWordSize)); |
| 250 __ addiu(SP, SP, Immediate(2 * kWordSize)); | 251 __ addiu(SP, SP, Immediate(2 * kWordSize)); |
| 251 // Remove the stub frame. | 252 // Remove the stub frame. |
| 252 __ LeaveStubFrame(); | 253 __ LeaveStubFrame(); |
| 254 | |
| 253 // Jump to the dart function. | 255 // Jump to the dart function. |
| 254 __ lw(T0, FieldAddress(T0, Code::instructions_offset())); | 256 __ lw(T0, FieldAddress(T0, Code::instructions_offset())); |
| 255 __ AddImmediate(T0, T0, Instructions::HeaderSize() - kHeapObjectTag); | 257 __ AddImmediate(T0, T0, Instructions::HeaderSize() - kHeapObjectTag); |
| 256 __ jr(T0); | 258 __ jr(T0); |
| 259 __ delay_slot()->LeaveStubFrameSPRestore(); | |
| 257 } | 260 } |
| 258 | 261 |
| 259 | 262 |
| 260 // Input parameters: | 263 // Input parameters: |
| 261 // A1: Smi-tagged argument count, may be zero. | 264 // A1: Smi-tagged argument count, may be zero. |
| 262 // FP[kLastParamSlotIndex]: Last argument. | 265 // FP[kLastParamSlotIndex]: Last argument. |
| 263 static void PushArgumentsArray(Assembler* assembler) { | 266 static void PushArgumentsArray(Assembler* assembler) { |
| 264 __ TraceSimMsg("PushArgumentsArray"); | 267 __ TraceSimMsg("PushArgumentsArray"); |
| 265 // Allocate array to store arguments of caller. | 268 // Allocate array to store arguments of caller. |
| 266 __ LoadImmediate(A0, reinterpret_cast<intptr_t>(Object::null())); | 269 __ LoadImmediate(A0, reinterpret_cast<intptr_t>(Object::null())); |
| 267 // A0: Null element type for raw Array. | 270 // A0: Null element type for raw Array. |
| 268 // A1: Smi-tagged argument count, may be zero. | 271 // A1: Smi-tagged argument count, may be zero. |
| 269 __ BranchLink(&StubCode::AllocateArrayLabel()); | 272 __ BranchLink(&StubCode::AllocateArrayLabel()); |
| 270 __ TraceSimMsg("PushArgumentsArray return"); | 273 __ TraceSimMsg("PushArgumentsArray return"); |
| 271 // V0: newly allocated array. | 274 // V0: newly allocated array. |
| 272 // A1: Smi-tagged argument count, may be zero (was preserved by the stub). | 275 // A1: Smi-tagged argument count, may be zero (was preserved by the stub). |
| 273 __ Push(V0); // Array is in V0 and on top of stack. | 276 __ Push(V0); // Array is in V0 and on top of stack. |
| 274 __ sll(T1, A1, 1); | 277 __ sll(T1, A1, 1); |
| 275 __ addu(T1, FP, T1); | 278 __ addu(T1, FP, T1); |
| 276 __ AddImmediate(T1, (kLastParamSlotIndex - 1) * kWordSize); | 279 __ AddImmediate(T1, (kLastParamSlotIndex - 1) * kWordSize); |
| 277 __ AddImmediate(T2, V0, Array::data_offset() - kHeapObjectTag); | |
| 278 // T1: address of first argument on stack. | 280 // T1: address of first argument on stack. |
| 279 // T2: address of first argument in array. | 281 // T2: address of first argument in array. |
| 280 Label loop, loop_condition; | 282 |
| 281 __ b(&loop_condition); | 283 Label loop, loop_exit; |
| 284 __ blez(A1, &loop_exit); | |
| 285 __ delay_slot()->addiu(T2, V0, | |
| 286 Immediate(Array::data_offset() - kHeapObjectTag)); | |
| 282 __ Bind(&loop); | 287 __ Bind(&loop); |
| 283 __ lw(TMP, Address(T1)); | 288 __ lw(TMP, Address(T1)); |
| 284 __ sw(TMP, Address(T2)); | 289 __ addiu(A1, A1, Immediate(-Smi::RawValue(1))); |
| 285 __ AddImmediate(T1, -kWordSize); | 290 __ addiu(T1, T1, Immediate(-kWordSize)); |
| 286 __ AddImmediate(T2, kWordSize); | 291 __ addiu(T2, T2, Immediate(kWordSize)); |
| 287 __ Bind(&loop_condition); | 292 __ bgez(A1, &loop); |
| 288 __ AddImmediate(A1, -Smi::RawValue(1)); // A1 is Smi. | 293 __ delay_slot()->sw(TMP, Address(T2, -kWordSize)); |
| 289 __ BranchSignedGreaterEqual(A1, ZR, &loop); | 294 __ Bind(&loop_exit); |
| 290 } | 295 } |
| 291 | 296 |
| 292 | 297 |
| 293 // Input parameters: | 298 // Input parameters: |
| 294 // S5: ic-data. | 299 // S5: ic-data. |
| 295 // S4: arguments descriptor array. | 300 // S4: arguments descriptor array. |
| 296 // Note: The receiver object is the first argument to the function being | 301 // Note: The receiver object is the first argument to the function being |
| 297 // called, the stub accesses the receiver from this location directly | 302 // called, the stub accesses the receiver from this location directly |
| 298 // when trying to resolve the call. | 303 // when trying to resolve the call. |
| 299 void StubCode::GenerateInstanceFunctionLookupStub(Assembler* assembler) { | 304 void StubCode::GenerateInstanceFunctionLookupStub(Assembler* assembler) { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 331 // TOS + 6: dart code return address | 336 // TOS + 6: dart code return address |
| 332 // TOS + 7: pc marker (0 for stub). | 337 // TOS + 7: pc marker (0 for stub). |
| 333 // TOS + 8: last argument of caller. | 338 // TOS + 8: last argument of caller. |
| 334 // .... | 339 // .... |
| 335 __ CallRuntime(kInstanceFunctionLookupRuntimeEntry); | 340 __ CallRuntime(kInstanceFunctionLookupRuntimeEntry); |
| 336 // Remove arguments. | 341 // Remove arguments. |
| 337 __ lw(V0, Address(SP, 4 * kWordSize)); | 342 __ lw(V0, Address(SP, 4 * kWordSize)); |
| 338 __ addiu(SP, SP, Immediate(5 * kWordSize)); // Get result into V0. | 343 __ addiu(SP, SP, Immediate(5 * kWordSize)); // Get result into V0. |
| 339 __ LeaveStubFrame(); | 344 __ LeaveStubFrame(); |
| 340 __ Ret(); | 345 __ Ret(); |
| 346 __ delay_slot()->LeaveStubFrameSPRestore(); | |
| 341 } | 347 } |
| 342 | 348 |
| 343 | 349 |
| 344 DECLARE_LEAF_RUNTIME_ENTRY(intptr_t, DeoptimizeCopyFrame, | 350 DECLARE_LEAF_RUNTIME_ENTRY(intptr_t, DeoptimizeCopyFrame, |
| 345 intptr_t deopt_reason, | 351 intptr_t deopt_reason, |
| 346 uword saved_registers_address); | 352 uword saved_registers_address); |
| 347 | 353 |
| 348 DECLARE_LEAF_RUNTIME_ENTRY(void, DeoptimizeFillFrame, uword last_fp); | 354 DECLARE_LEAF_RUNTIME_ENTRY(void, DeoptimizeFillFrame, uword last_fp); |
| 349 | 355 |
| 350 | 356 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 447 __ EnterStubFrame(); | 453 __ EnterStubFrame(); |
| 448 if (preserve_result) { | 454 if (preserve_result) { |
| 449 __ Push(T1); // Preserve result, it will be GC-d here. | 455 __ Push(T1); // Preserve result, it will be GC-d here. |
| 450 } | 456 } |
| 451 __ CallRuntime(kDeoptimizeMaterializeDoublesRuntimeEntry); | 457 __ CallRuntime(kDeoptimizeMaterializeDoublesRuntimeEntry); |
| 452 if (preserve_result) { | 458 if (preserve_result) { |
| 453 __ Pop(V0); // Restore result. | 459 __ Pop(V0); // Restore result. |
| 454 } | 460 } |
| 455 __ LeaveStubFrame(); | 461 __ LeaveStubFrame(); |
| 456 __ Ret(); | 462 __ Ret(); |
| 463 __ delay_slot()->LeaveStubFrameSPRestore(); | |
| 457 } | 464 } |
| 458 | 465 |
| 459 | 466 |
| 460 void StubCode::GenerateDeoptimizeLazyStub(Assembler* assembler) { | 467 void StubCode::GenerateDeoptimizeLazyStub(Assembler* assembler) { |
| 461 __ Unimplemented("DeoptimizeLazy stub"); | 468 __ Unimplemented("DeoptimizeLazy stub"); |
| 462 } | 469 } |
| 463 | 470 |
| 464 | 471 |
| 465 void StubCode::GenerateDeoptimizeStub(Assembler* assembler) { | 472 void StubCode::GenerateDeoptimizeStub(Assembler* assembler) { |
| 466 GenerateDeoptimizationSequence(assembler, false); // Don't preserve V0. | 473 GenerateDeoptimizationSequence(assembler, false); // Don't preserve V0. |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 563 // Get the class index and insert it into the tags. | 570 // Get the class index and insert it into the tags. |
| 564 __ LoadImmediate(TMP1, RawObject::ClassIdTag::encode(kArrayCid)); | 571 __ LoadImmediate(TMP1, RawObject::ClassIdTag::encode(kArrayCid)); |
| 565 __ or_(T3, T3, TMP1); | 572 __ or_(T3, T3, TMP1); |
| 566 __ sw(T3, FieldAddress(V0, Array::tags_offset())); | 573 __ sw(T3, FieldAddress(V0, Array::tags_offset())); |
| 567 | 574 |
| 568 // Initialize all array elements to raw_null. | 575 // Initialize all array elements to raw_null. |
| 569 // V0: new object start as a tagged pointer. | 576 // V0: new object start as a tagged pointer. |
| 570 // T2: new object end address. | 577 // T2: new object end address. |
| 571 // A1: Array length as Smi. | 578 // A1: Array length as Smi. |
| 572 __ AddImmediate(T3, V0, Array::data_offset() - kHeapObjectTag); | 579 __ AddImmediate(T3, V0, Array::data_offset() - kHeapObjectTag); |
| 573 // R1: iterator which initially points to the start of the variable | 580 // T3: iterator which initially points to the start of the variable |
| 574 // data area to be initialized. | 581 // data area to be initialized. |
| 575 __ LoadImmediate(TMP1, reinterpret_cast<intptr_t>(Object::null())); | 582 |
| 576 Label loop, test; | 583 Label loop, loop_exit; |
| 577 __ b(&test); | 584 intptr_t null = reinterpret_cast<intptr_t>(Object::null()); |
| 585 uint16_t null_lo = Utils::Low16Bits(null); | |
| 586 uint16_t null_hi = Utils::High16Bits(null); | |
| 587 __ lui(TMP1, Immediate(null_hi)); | |
| 588 __ BranchUnsignedGreaterEqual(T3, T2, &loop_exit); | |
| 589 __ delay_slot()->ori(TMP1, TMP1, Immediate(null_lo)); | |
| 578 __ Bind(&loop); | 590 __ Bind(&loop); |
| 579 // TODO(cshapiro): StoreIntoObjectNoBarrier | 591 __ addiu(T3, T3, Immediate(kWordSize)); |
| 580 __ sw(TMP1, Address(T3, 0)); | |
| 581 __ AddImmediate(T3, kWordSize); | |
| 582 __ Bind(&test); | |
| 583 __ bne(T3, T2, &loop); | 592 __ bne(T3, T2, &loop); |
| 593 __ delay_slot()->sw(TMP1, Address(T3, -kWordSize)); | |
| 594 __ Bind(&loop_exit); | |
| 584 | 595 |
| 585 // Done allocating and initializing the array. | 596 // Done allocating and initializing the array. |
| 586 // V0: new object. | 597 // V0: new object. |
| 587 // A1: Array length as Smi (preserved for the caller.) | 598 // A1: Array length as Smi (preserved for the caller.) |
| 588 __ Ret(); | 599 __ Ret(); |
| 589 } | 600 } |
| 590 | 601 |
| 591 // Unable to allocate the array using the fast inline code, just call | 602 // Unable to allocate the array using the fast inline code, just call |
| 592 // into the runtime. | 603 // into the runtime. |
| 593 __ Bind(&slow_case); | 604 __ Bind(&slow_case); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 604 __ CallRuntime(kAllocateArrayRuntimeEntry); | 615 __ CallRuntime(kAllocateArrayRuntimeEntry); |
| 605 __ TraceSimMsg("AllocateArrayStub return"); | 616 __ TraceSimMsg("AllocateArrayStub return"); |
| 606 // Pop arguments; result is popped in IP. | 617 // Pop arguments; result is popped in IP. |
| 607 __ lw(TMP1, Address(SP, 2 * kWordSize)); | 618 __ lw(TMP1, Address(SP, 2 * kWordSize)); |
| 608 __ lw(A1, Address(SP, 1 * kWordSize)); | 619 __ lw(A1, Address(SP, 1 * kWordSize)); |
| 609 __ lw(T3, Address(SP, 0 * kWordSize)); | 620 __ lw(T3, Address(SP, 0 * kWordSize)); |
| 610 __ addiu(SP, SP, Immediate(3 * kWordSize)); | 621 __ addiu(SP, SP, Immediate(3 * kWordSize)); |
| 611 __ mov(V0, TMP1); | 622 __ mov(V0, TMP1); |
| 612 __ LeaveStubFrame(); | 623 __ LeaveStubFrame(); |
| 613 __ Ret(); | 624 __ Ret(); |
| 625 __ delay_slot()->LeaveStubFrameSPRestore(); | |
| 614 } | 626 } |
| 615 | 627 |
| 616 | 628 |
| 617 // Input parameters: | 629 // Input parameters: |
| 618 // RA: return address. | 630 // RA: return address. |
| 619 // SP: address of last argument. | 631 // SP: address of last argument. |
| 620 // S4: Arguments descriptor array. | 632 // S4: Arguments descriptor array. |
| 621 // Return: V0. | 633 // Return: V0. |
| 622 // Note: The closure object is the first argument to the function being | 634 // Note: The closure object is the first argument to the function being |
| 623 // called, the stub accesses the closure from this location directly | 635 // called, the stub accesses the closure from this location directly |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 675 __ TraceSimMsg("GenerateCallClosureFunctionStub return"); | 687 __ TraceSimMsg("GenerateCallClosureFunctionStub return"); |
| 676 // Restore arguments descriptor array and read-only function object argument. | 688 // Restore arguments descriptor array and read-only function object argument. |
| 677 __ lw(T2, Address(SP, 0 * kWordSize)); | 689 __ lw(T2, Address(SP, 0 * kWordSize)); |
| 678 __ lw(S4, Address(SP, 1 * kWordSize)); | 690 __ lw(S4, Address(SP, 1 * kWordSize)); |
| 679 __ addiu(SP, SP, Immediate(2 * kWordSize)); | 691 __ addiu(SP, SP, Immediate(2 * kWordSize)); |
| 680 // Restore T0. | 692 // Restore T0. |
| 681 __ lw(T0, FieldAddress(T2, Function::code_offset())); | 693 __ lw(T0, FieldAddress(T2, Function::code_offset())); |
| 682 | 694 |
| 683 // Remove the stub frame as we are about to jump to the closure function. | 695 // Remove the stub frame as we are about to jump to the closure function. |
| 684 __ LeaveStubFrame(); | 696 __ LeaveStubFrame(); |
| 697 __ LeaveStubFrameSPRestore(); | |
| 685 | 698 |
| 686 __ Bind(&function_compiled); | 699 __ Bind(&function_compiled); |
| 687 // T0: Code. | 700 // T0: Code. |
| 688 // S4: Arguments descriptor array. | 701 // S4: Arguments descriptor array. |
| 689 __ lw(T0, FieldAddress(T0, Code::instructions_offset())); | 702 __ lw(T0, FieldAddress(T0, Code::instructions_offset())); |
| 690 __ AddImmediate(T0, Instructions::HeaderSize() - kHeapObjectTag); | 703 __ AddImmediate(T0, Instructions::HeaderSize() - kHeapObjectTag); |
| 691 __ jr(T0); | 704 __ jr(T0); |
| 692 | 705 |
| 693 __ Bind(¬_closure); | 706 __ Bind(¬_closure); |
| 694 // Call runtime to attempt to resolve and invoke a call method on a | 707 // Call runtime to attempt to resolve and invoke a call method on a |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 720 // TOS + 5: PC marker (0 for stub). | 733 // TOS + 5: PC marker (0 for stub). |
| 721 // TOS + 6: Last argument of caller. | 734 // TOS + 6: Last argument of caller. |
| 722 // .... | 735 // .... |
| 723 __ CallRuntime(kInvokeNonClosureRuntimeEntry); | 736 __ CallRuntime(kInvokeNonClosureRuntimeEntry); |
| 724 __ lw(V0, Address(SP, 2 * kWordSize)); // Get result into V0. | 737 __ lw(V0, Address(SP, 2 * kWordSize)); // Get result into V0. |
| 725 __ addiu(SP, SP, Immediate(3 * kWordSize)); // Remove arguments. | 738 __ addiu(SP, SP, Immediate(3 * kWordSize)); // Remove arguments. |
| 726 | 739 |
| 727 // Remove the stub frame as we are about to return. | 740 // Remove the stub frame as we are about to return. |
| 728 __ LeaveStubFrame(); | 741 __ LeaveStubFrame(); |
| 729 __ Ret(); | 742 __ Ret(); |
| 743 __ delay_slot()->LeaveStubFrameSPRestore(); | |
| 730 } | 744 } |
| 731 | 745 |
| 732 | 746 |
| 733 // Called when invoking Dart code from C++ (VM code). | 747 // Called when invoking Dart code from C++ (VM code). |
| 734 // Input parameters: | 748 // Input parameters: |
| 735 // RA : points to return address. | 749 // RA : points to return address. |
| 736 // A0 : entrypoint of the Dart function to call. | 750 // A0 : entrypoint of the Dart function to call. |
| 737 // A1 : arguments descriptor array. | 751 // A1 : arguments descriptor array. |
| 738 // A2 : arguments array. | 752 // A2 : arguments array. |
| 739 // A3 : new context containing the current isolate pointer. | 753 // A3 : new context containing the current isolate pointer. |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 788 | 802 |
| 789 // Load arguments descriptor array into S4, which is passed to Dart code. | 803 // Load arguments descriptor array into S4, which is passed to Dart code. |
| 790 __ lw(S4, Address(A1, VMHandles::kOffsetOfRawPtrInHandle)); | 804 __ lw(S4, Address(A1, VMHandles::kOffsetOfRawPtrInHandle)); |
| 791 | 805 |
| 792 // Load number of arguments into S5. | 806 // Load number of arguments into S5. |
| 793 __ lw(T1, FieldAddress(S4, ArgumentsDescriptor::count_offset())); | 807 __ lw(T1, FieldAddress(S4, ArgumentsDescriptor::count_offset())); |
| 794 __ SmiUntag(T1); | 808 __ SmiUntag(T1); |
| 795 | 809 |
| 796 // Compute address of 'arguments array' data area into A2. | 810 // Compute address of 'arguments array' data area into A2. |
| 797 __ lw(A2, Address(A2, VMHandles::kOffsetOfRawPtrInHandle)); | 811 __ lw(A2, Address(A2, VMHandles::kOffsetOfRawPtrInHandle)); |
| 798 __ AddImmediate(A2, Array::data_offset() - kHeapObjectTag); | |
| 799 | 812 |
| 800 // Set up arguments for the Dart call. | 813 // Set up arguments for the Dart call. |
| 801 Label push_arguments; | 814 Label push_arguments; |
| 802 Label done_push_arguments; | 815 Label done_push_arguments; |
| 803 __ beq(T1, ZR, &done_push_arguments); // check if there are arguments. | 816 __ beq(T1, ZR, &done_push_arguments); // check if there are arguments. |
| 817 __ delay_slot()->addiu(A2, A2, | |
| 818 Immediate(Array::data_offset() - kHeapObjectTag)); | |
| 804 __ mov(A1, ZR); | 819 __ mov(A1, ZR); |
| 805 __ Bind(&push_arguments); | 820 __ Bind(&push_arguments); |
| 806 __ lw(A3, Address(A2)); | 821 __ lw(A3, Address(A2)); |
| 807 __ Push(A3); | 822 __ Push(A3); |
| 808 __ addiu(A1, A1, Immediate(1)); | 823 __ addiu(A1, A1, Immediate(1)); |
| 809 __ BranchSignedLess(A1, T1, &push_arguments); | 824 __ BranchSignedLess(A1, T1, &push_arguments); |
| 810 __ delay_slot()->addiu(A2, A2, Immediate(kWordSize)); | 825 __ delay_slot()->addiu(A2, A2, Immediate(kWordSize)); |
| 811 | 826 |
| 812 __ Bind(&done_push_arguments); | 827 __ Bind(&done_push_arguments); |
| 813 | 828 |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 838 for (int i = S0; i <= S7; i++) { | 853 for (int i = S0; i <= S7; i++) { |
| 839 Register r = static_cast<Register>(i); | 854 Register r = static_cast<Register>(i); |
| 840 __ lw(r, Address(SP, (i - S0 + 3) * kWordSize)); | 855 __ lw(r, Address(SP, (i - S0 + 3) * kWordSize)); |
| 841 } | 856 } |
| 842 __ lw(A3, Address(SP, 2 * kWordSize)); | 857 __ lw(A3, Address(SP, 2 * kWordSize)); |
| 843 __ addiu(SP, SP, Immediate((3 + kAbiPreservedCpuRegCount) * kWordSize)); | 858 __ addiu(SP, SP, Immediate((3 + kAbiPreservedCpuRegCount) * kWordSize)); |
| 844 | 859 |
| 845 // Restore the frame pointer and return. | 860 // Restore the frame pointer and return. |
| 846 __ LeaveStubFrame(); | 861 __ LeaveStubFrame(); |
| 847 __ Ret(); | 862 __ Ret(); |
| 863 __ delay_slot()->LeaveStubFrameSPRestore(); | |
| 848 } | 864 } |
| 849 | 865 |
| 850 | 866 |
| 851 // Called for inline allocation of contexts. | 867 // Called for inline allocation of contexts. |
| 852 // Input: | 868 // Input: |
| 853 // T1: number of context variables. | 869 // T1: number of context variables. |
| 854 // Output: | 870 // Output: |
| 855 // V0: new allocated RawContext object. | 871 // V0: new allocated RawContext object. |
| 856 void StubCode::GenerateAllocateContextStub(Assembler* assembler) { | 872 void StubCode::GenerateAllocateContextStub(Assembler* assembler) { |
| 857 if (FLAG_inline_alloc) { | 873 if (FLAG_inline_alloc) { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 920 __ sw(T1, FieldAddress(V0, Context::num_variables_offset())); | 936 __ sw(T1, FieldAddress(V0, Context::num_variables_offset())); |
| 921 | 937 |
| 922 // Setup isolate field. | 938 // Setup isolate field. |
| 923 // Load Isolate pointer from Context structure into R2. | 939 // Load Isolate pointer from Context structure into R2. |
| 924 // V0: new object. | 940 // V0: new object. |
| 925 // T1: number of context variables. | 941 // T1: number of context variables. |
| 926 __ lw(T2, FieldAddress(CTX, Context::isolate_offset())); | 942 __ lw(T2, FieldAddress(CTX, Context::isolate_offset())); |
| 927 // T2: isolate, not an object. | 943 // T2: isolate, not an object. |
| 928 __ sw(T2, FieldAddress(V0, Context::isolate_offset())); | 944 __ sw(T2, FieldAddress(V0, Context::isolate_offset())); |
| 929 | 945 |
| 930 // Setup the parent field. | |
| 931 // V0: new object. | |
| 932 // T1: number of context variables. | |
| 933 __ LoadImmediate(T2, reinterpret_cast<intptr_t>(Object::null())); | 946 __ LoadImmediate(T2, reinterpret_cast<intptr_t>(Object::null())); |
| 934 __ sw(T2, FieldAddress(V0, Context::parent_offset())); | |
| 935 | 947 |
| 936 // Initialize the context variables. | 948 // Initialize the context variables. |
| 937 // V0: new object. | 949 // V0: new object. |
| 938 // T1: number of context variables. | 950 // T1: number of context variables. |
| 939 // T2: raw null. | 951 // T2: raw null. |
| 940 Label loop, loop_test; | 952 Label loop, loop_exit; |
| 953 __ blez(T1, &loop_exit); | |
| 954 // Setup the parent field. | |
| 955 __ delay_slot()->sw(T2, FieldAddress(V0, Context::parent_offset())); | |
| 941 __ AddImmediate(T3, V0, Context::variable_offset(0) - kHeapObjectTag); | 956 __ AddImmediate(T3, V0, Context::variable_offset(0) - kHeapObjectTag); |
| 942 __ b(&loop_test); | 957 __ sll(T1, T1, 2); |
| 943 __ delay_slot()->sll(T1, T1, 2); | |
| 944 __ Bind(&loop); | 958 __ Bind(&loop); |
| 959 __ addiu(T1, T1, Immediate(-kWordSize)); | |
| 945 __ addu(TMP1, T3, T1); | 960 __ addu(TMP1, T3, T1); |
| 946 __ sw(T2, Address(TMP1)); | 961 __ bgtz(T1, &loop); |
| 947 __ Bind(&loop_test); | 962 __ delay_slot()->sw(T2, Address(TMP1)); |
| 948 __ addiu(T1, T1, Immediate(-kWordSize)); | 963 __ Bind(&loop_exit); |
| 949 __ bne(T1, ZR, &loop); // Loop if R1 not zero. | |
| 950 | 964 |
| 951 // Done allocating and initializing the context. | 965 // Done allocating and initializing the context. |
| 952 // V0: new object. | 966 // V0: new object. |
| 953 __ Ret(); | 967 __ Ret(); |
| 954 | 968 |
| 955 __ Bind(&slow_case); | 969 __ Bind(&slow_case); |
| 956 } | 970 } |
| 957 // Create a stub frame as we are pushing some objects on the stack before | 971 // Create a stub frame as we are pushing some objects on the stack before |
| 958 // calling into the runtime. | 972 // calling into the runtime. |
| 959 __ EnterStubFrame(); | 973 __ EnterStubFrame(); |
| 960 // Setup space on stack for return value. | 974 // Setup space on stack for return value. |
| 961 __ LoadImmediate(T2, reinterpret_cast<intptr_t>(Object::null())); | 975 __ LoadImmediate(T2, reinterpret_cast<intptr_t>(Object::null())); |
| 962 __ SmiTag(T1); | 976 __ SmiTag(T1); |
| 963 __ addiu(SP, SP, Immediate(-2 * kWordSize)); | 977 __ addiu(SP, SP, Immediate(-2 * kWordSize)); |
| 964 __ sw(T2, Address(SP, 1 * kWordSize)); | 978 __ sw(T2, Address(SP, 1 * kWordSize)); |
| 965 __ sw(T1, Address(SP, 0 * kWordSize)); | 979 __ sw(T1, Address(SP, 0 * kWordSize)); |
| 966 __ CallRuntime(kAllocateContextRuntimeEntry); // Allocate context. | 980 __ CallRuntime(kAllocateContextRuntimeEntry); // Allocate context. |
| 967 __ lw(V0, Address(SP, 1 * kWordSize)); // Get the new context. | 981 __ lw(V0, Address(SP, 1 * kWordSize)); // Get the new context. |
| 968 __ addiu(SP, SP, Immediate(2 * kWordSize)); // Pop argument and return. | 982 __ addiu(SP, SP, Immediate(2 * kWordSize)); // Pop argument and return. |
| 969 | 983 |
| 970 // V0: new object | 984 // V0: new object |
| 971 // Restore the frame pointer. | 985 // Restore the frame pointer. |
| 972 __ LeaveStubFrame(); | 986 __ LeaveStubFrame(); |
| 987 __ LeaveStubFrameSPRestore(); | |
|
regis
2013/05/01 01:21:46
Why didn't you use the delay slot here?
zra
2013/05/01 16:53:17
Missed it. Thanks!
| |
| 973 __ Ret(); | 988 __ Ret(); |
| 974 } | 989 } |
| 975 | 990 |
| 976 | 991 |
| 977 DECLARE_LEAF_RUNTIME_ENTRY(void, StoreBufferBlockProcess, Isolate* isolate); | 992 DECLARE_LEAF_RUNTIME_ENTRY(void, StoreBufferBlockProcess, Isolate* isolate); |
| 978 | 993 |
| 979 | 994 |
| 980 // Helper stub to implement Assembler::StoreIntoObject. | 995 // Helper stub to implement Assembler::StoreIntoObject. |
| 981 // Input parameters: | 996 // Input parameters: |
| 982 // T0: Address (i.e. object) being stored into. | 997 // T0: Address (i.e. object) being stored into. |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1145 __ sw(T0, Address(T2, current_offset)); | 1160 __ sw(T0, Address(T2, current_offset)); |
| 1146 } | 1161 } |
| 1147 } else { | 1162 } else { |
| 1148 __ addiu(T4, T2, Immediate(sizeof(RawObject))); | 1163 __ addiu(T4, T2, Immediate(sizeof(RawObject))); |
| 1149 // Loop until the whole object is initialized. | 1164 // Loop until the whole object is initialized. |
| 1150 // T0: raw null. | 1165 // T0: raw null. |
| 1151 // T2: new object. | 1166 // T2: new object. |
| 1152 // T3: next object start. | 1167 // T3: next object start. |
| 1153 // T4: next word to be initialized. | 1168 // T4: next word to be initialized. |
| 1154 // T1: new object type arguments (if is_cls_parameterized). | 1169 // T1: new object type arguments (if is_cls_parameterized). |
| 1155 Label init_loop; | 1170 Label loop, loop_exit; |
| 1156 Label done; | 1171 __ BranchUnsignedGreaterEqual(T4, T3, &loop_exit); |
| 1157 __ Bind(&init_loop); | 1172 __ Bind(&loop); |
| 1158 __ BranchUnsignedGreaterEqual(T4, T3, &done); // Done if T4 >= T3. | 1173 __ addiu(T4, T4, Immediate(kWordSize)); |
| 1159 __ sw(T0, Address(T4)); | 1174 __ bne(T4, T3, &loop); |
| 1160 __ AddImmediate(T4, kWordSize); | 1175 __ delay_slot()->sw(T0, Address(T4, -kWordSize)); |
| 1161 __ b(&init_loop); | 1176 __ Bind(&loop_exit); |
| 1162 __ Bind(&done); | |
| 1163 } | 1177 } |
| 1164 if (is_cls_parameterized) { | 1178 if (is_cls_parameterized) { |
| 1165 // R1: new object type arguments. | 1179 // R1: new object type arguments. |
| 1166 // Set the type arguments in the new object. | 1180 // Set the type arguments in the new object. |
| 1167 __ sw(T1, Address(T2, cls.type_arguments_field_offset())); | 1181 __ sw(T1, Address(T2, cls.type_arguments_field_offset())); |
| 1168 } | 1182 } |
| 1169 // Done allocating and initializing the instance. | 1183 // Done allocating and initializing the instance. |
| 1170 // T2: new object still missing its heap tag. | 1184 // T2: new object still missing its heap tag. |
| 1171 __ Ret(); | 1185 __ Ret(); |
| 1172 __ delay_slot()->addiu(V0, T2, Immediate(kHeapObjectTag)); | 1186 __ delay_slot()->addiu(V0, T2, Immediate(kHeapObjectTag)); |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 1199 } | 1213 } |
| 1200 __ CallRuntime(kAllocateObjectRuntimeEntry); // Allocate object. | 1214 __ CallRuntime(kAllocateObjectRuntimeEntry); // Allocate object. |
| 1201 __ TraceSimMsg("AllocationStubForClass return"); | 1215 __ TraceSimMsg("AllocationStubForClass return"); |
| 1202 // Pop result (newly allocated object). | 1216 // Pop result (newly allocated object). |
| 1203 __ lw(V0, Address(SP, 3 * kWordSize)); | 1217 __ lw(V0, Address(SP, 3 * kWordSize)); |
| 1204 __ addiu(SP, SP, Immediate(4 * kWordSize)); // Pop arguments. | 1218 __ addiu(SP, SP, Immediate(4 * kWordSize)); // Pop arguments. |
| 1205 // V0: new object | 1219 // V0: new object |
| 1206 // Restore the frame pointer. | 1220 // Restore the frame pointer. |
| 1207 __ LeaveStubFrame(true); | 1221 __ LeaveStubFrame(true); |
| 1208 __ Ret(); | 1222 __ Ret(); |
| 1223 __ delay_slot()->LeaveStubFrameSPRestore(true); | |
| 1209 } | 1224 } |
| 1210 | 1225 |
| 1211 | 1226 |
| 1212 // Called for inline allocation of closures. | 1227 // Called for inline allocation of closures. |
| 1213 // Input parameters: | 1228 // Input parameters: |
| 1214 // RA: return address. | 1229 // RA: return address. |
| 1215 // SP + 4 : receiver (null if not an implicit instance closure). | 1230 // SP + 4 : receiver (null if not an implicit instance closure). |
| 1216 // SP + 0 : type arguments object (null if class is no parameterized). | 1231 // SP + 0 : type arguments object (null if class is no parameterized). |
| 1217 void StubCode::GenerateAllocationStubForClosure(Assembler* assembler, | 1232 void StubCode::GenerateAllocationStubForClosure(Assembler* assembler, |
| 1218 const Function& func) { | 1233 const Function& func) { |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1315 | 1330 |
| 1316 // Set the type arguments field in the newly allocated closure. | 1331 // Set the type arguments field in the newly allocated closure. |
| 1317 __ lw(T0, Address(FP, kTypeArgumentsFPOffset)); | 1332 __ lw(T0, Address(FP, kTypeArgumentsFPOffset)); |
| 1318 __ sw(T0, Address(T2, Closure::type_arguments_offset())); | 1333 __ sw(T0, Address(T2, Closure::type_arguments_offset())); |
| 1319 | 1334 |
| 1320 // Done allocating and initializing the instance. | 1335 // Done allocating and initializing the instance. |
| 1321 // V0: new object. | 1336 // V0: new object. |
| 1322 __ addiu(V0, T2, Immediate(kHeapObjectTag)); | 1337 __ addiu(V0, T2, Immediate(kHeapObjectTag)); |
| 1323 __ LeaveStubFrame(true); | 1338 __ LeaveStubFrame(true); |
| 1324 __ Ret(); | 1339 __ Ret(); |
| 1340 __ delay_slot()->LeaveStubFrameSPRestore(true); | |
| 1325 | 1341 |
| 1326 __ Bind(&slow_case); | 1342 __ Bind(&slow_case); |
| 1327 } | 1343 } |
| 1328 | 1344 |
| 1329 // If it's an implicit static closure we need 2 stack slots. Otherwise, | 1345 // If it's an implicit static closure we need 2 stack slots. Otherwise, |
| 1330 // If it's an implicit instance closure we need 4 stack slots, o/w only 3. | 1346 // If it's an implicit instance closure we need 4 stack slots, o/w only 3. |
| 1331 int num_slots = 2; | 1347 int num_slots = 2; |
| 1332 if (!is_implicit_static_closure) { | 1348 if (!is_implicit_static_closure) { |
| 1333 num_slots = is_implicit_instance_closure ? 4 : 3; | 1349 num_slots = is_implicit_instance_closure ? 4 : 3; |
| 1334 } | 1350 } |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 1362 __ TraceSimMsg("AllocationStubForClosure return"); | 1378 __ TraceSimMsg("AllocationStubForClosure return"); |
| 1363 } | 1379 } |
| 1364 } | 1380 } |
| 1365 __ lw(V0, Address(SP, (num_slots - 1) * kWordSize)); // Pop function object. | 1381 __ lw(V0, Address(SP, (num_slots - 1) * kWordSize)); // Pop function object. |
| 1366 __ addiu(SP, SP, Immediate(num_slots * kWordSize)); | 1382 __ addiu(SP, SP, Immediate(num_slots * kWordSize)); |
| 1367 | 1383 |
| 1368 // V0: new object | 1384 // V0: new object |
| 1369 // Restore the frame pointer. | 1385 // Restore the frame pointer. |
| 1370 __ LeaveStubFrame(true); | 1386 __ LeaveStubFrame(true); |
| 1371 __ Ret(); | 1387 __ Ret(); |
| 1388 __ delay_slot()->LeaveStubFrameSPRestore(true); | |
| 1372 } | 1389 } |
| 1373 | 1390 |
| 1374 | 1391 |
| 1375 void StubCode::GenerateCallNoSuchMethodFunctionStub(Assembler* assembler) { | 1392 void StubCode::GenerateCallNoSuchMethodFunctionStub(Assembler* assembler) { |
| 1376 __ Unimplemented("CallNoSuchMethodFunction stub"); | 1393 __ Unimplemented("CallNoSuchMethodFunction stub"); |
| 1377 } | 1394 } |
| 1378 | 1395 |
| 1379 | 1396 |
| 1380 // T0: function object. | 1397 // T0: function object. |
| 1381 // S5: inline cache data object. | 1398 // S5: inline cache data object. |
| 1382 // S4: arguments descriptor array. | 1399 // S4: arguments descriptor array. |
| 1383 void StubCode::GenerateOptimizedUsageCounterIncrement(Assembler* assembler) { | 1400 void StubCode::GenerateOptimizedUsageCounterIncrement(Assembler* assembler) { |
| 1384 __ TraceSimMsg("OptimizedUsageCounterIncrement"); | 1401 __ TraceSimMsg("OptimizedUsageCounterIncrement"); |
| 1385 Register ic_reg = S5; | 1402 Register ic_reg = S5; |
| 1386 Register func_reg = T0; | 1403 Register func_reg = T0; |
| 1387 if (FLAG_trace_optimized_ic_calls) { | 1404 if (FLAG_trace_optimized_ic_calls) { |
| 1388 __ EnterStubFrame(); | 1405 __ EnterStubFrame(); |
| 1389 __ addiu(SP, SP, Immediate(-5 * kWordSize)); | 1406 __ addiu(SP, SP, Immediate(-5 * kWordSize)); |
| 1390 __ sw(T0, Address(SP, 4 * kWordSize)); | 1407 __ sw(T0, Address(SP, 4 * kWordSize)); |
| 1391 __ sw(S5, Address(SP, 3 * kWordSize)); | 1408 __ sw(S5, Address(SP, 3 * kWordSize)); |
| 1392 __ sw(S4, Address(SP, 2 * kWordSize)); // Preserve. | 1409 __ sw(S4, Address(SP, 2 * kWordSize)); // Preserve. |
| 1393 __ sw(ic_reg, Address(SP, 1 * kWordSize)); // Argument. | 1410 __ sw(ic_reg, Address(SP, 1 * kWordSize)); // Argument. |
| 1394 __ sw(func_reg, Address(SP, 0 * kWordSize)); // Argument. | 1411 __ sw(func_reg, Address(SP, 0 * kWordSize)); // Argument. |
| 1395 __ CallRuntime(kTraceICCallRuntimeEntry); | 1412 __ CallRuntime(kTraceICCallRuntimeEntry); |
| 1396 __ lw(S4, Address(SP, 2 * kWordSize)); // Restore. | 1413 __ lw(S4, Address(SP, 2 * kWordSize)); // Restore. |
| 1397 __ lw(S5, Address(SP, 3 * kWordSize)); | 1414 __ lw(S5, Address(SP, 3 * kWordSize)); |
| 1398 __ lw(T0, Address(SP, 4 * kWordSize)); | 1415 __ lw(T0, Address(SP, 4 * kWordSize)); |
| 1399 __ addiu(SP, SP, Immediate(5 * kWordSize)); // Discard argument; | 1416 __ addiu(SP, SP, Immediate(5 * kWordSize)); // Discard argument; |
| 1400 __ LeaveStubFrame(); | 1417 __ LeaveStubFrame(); |
| 1418 __ LeaveStubFrameSPRestore(); | |
| 1401 } | 1419 } |
| 1402 __ lw(T7, FieldAddress(func_reg, Function::usage_counter_offset())); | 1420 __ lw(T7, FieldAddress(func_reg, Function::usage_counter_offset())); |
| 1403 Label is_hot; | 1421 Label is_hot; |
| 1404 if (FlowGraphCompiler::CanOptimize()) { | 1422 if (FlowGraphCompiler::CanOptimize()) { |
| 1405 ASSERT(FLAG_optimization_counter_threshold > 1); | 1423 ASSERT(FLAG_optimization_counter_threshold > 1); |
| 1406 __ BranchSignedGreaterEqual(T7, FLAG_optimization_counter_threshold, | 1424 __ BranchSignedGreaterEqual(T7, FLAG_optimization_counter_threshold, |
| 1407 &is_hot); | 1425 &is_hot); |
| 1408 // As long as VM has no OSR do not optimize in the middle of the function | 1426 // As long as VM has no OSR do not optimize in the middle of the function |
| 1409 // but only at exit so that we have collected all type feedback before | 1427 // but only at exit so that we have collected all type feedback before |
| 1410 // optimizing. | 1428 // optimizing. |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1576 __ lw(T3, Address(SP, (num_slots - 3) * kWordSize)); | 1594 __ lw(T3, Address(SP, (num_slots - 3) * kWordSize)); |
| 1577 __ lw(S4, Address(SP, (num_slots - 2) * kWordSize)); | 1595 __ lw(S4, Address(SP, (num_slots - 2) * kWordSize)); |
| 1578 __ lw(S5, Address(SP, (num_slots - 1) * kWordSize)); | 1596 __ lw(S5, Address(SP, (num_slots - 1) * kWordSize)); |
| 1579 // Remove the call arguments pushed earlier, including the IC data object | 1597 // Remove the call arguments pushed earlier, including the IC data object |
| 1580 // and the arguments descriptor array. | 1598 // and the arguments descriptor array. |
| 1581 __ addiu(SP, SP, Immediate(num_slots * kWordSize)); | 1599 __ addiu(SP, SP, Immediate(num_slots * kWordSize)); |
| 1582 __ LeaveStubFrame(); | 1600 __ LeaveStubFrame(); |
| 1583 Label call_target_function; | 1601 Label call_target_function; |
| 1584 __ BranchNotEqual(T3, reinterpret_cast<intptr_t>(Object::null()), | 1602 __ BranchNotEqual(T3, reinterpret_cast<intptr_t>(Object::null()), |
| 1585 &call_target_function); | 1603 &call_target_function); |
| 1604 __ delay_slot()->LeaveStubFrameSPRestore(); | |
| 1586 // NoSuchMethod or closure. | 1605 // NoSuchMethod or closure. |
| 1587 // Mark IC call that it may be a closure call that does not collect | 1606 // Mark IC call that it may be a closure call that does not collect |
| 1588 // type feedback. | 1607 // type feedback. |
| 1589 __ LoadImmediate(TMP2, 1); | 1608 __ LoadImmediate(TMP2, 1); |
| 1590 __ Branch(&StubCode::InstanceFunctionLookupLabel()); | 1609 __ Branch(&StubCode::InstanceFunctionLookupLabel()); |
| 1591 __ delay_slot()->sb(TMP2, FieldAddress(S5, ICData::is_closure_call_offset())); | 1610 __ delay_slot()->sb(TMP2, FieldAddress(S5, ICData::is_closure_call_offset())); |
| 1592 | 1611 |
| 1593 __ Bind(&found); | 1612 __ Bind(&found); |
| 1594 // T0: Pointer to an IC data check group. | 1613 // T0: Pointer to an IC data check group. |
| 1595 const intptr_t target_offset = ICData::TargetIndexFor(num_args) * kWordSize; | 1614 const intptr_t target_offset = ICData::TargetIndexFor(num_args) * kWordSize; |
| 1596 const intptr_t count_offset = ICData::CountIndexFor(num_args) * kWordSize; | 1615 const intptr_t count_offset = ICData::CountIndexFor(num_args) * kWordSize; |
| 1597 __ lw(T3, Address(T0, target_offset)); | 1616 __ lw(T3, Address(T0, target_offset)); |
| 1598 __ lw(T4, Address(T0, count_offset)); | 1617 __ lw(T4, Address(T0, count_offset)); |
| 1599 | 1618 |
| 1600 __ AddImmediateDetectOverflow(T4, T4, Smi::RawValue(1), T5); | 1619 __ AddImmediateDetectOverflow(T4, T4, Smi::RawValue(1), T5); |
| 1601 | 1620 |
| 1602 __ bgez(T5, &call_target_function); // No overflow. | 1621 __ bgez(T5, &call_target_function); // No overflow. |
| 1603 __ delay_slot()->sw(T4, Address(T0, count_offset)); | 1622 __ delay_slot()->sw(T4, Address(T0, count_offset)); |
| 1604 | 1623 |
| 1605 __ LoadImmediate(T1, Smi::RawValue(Smi::kMaxValue)); | 1624 __ LoadImmediate(T1, Smi::RawValue(Smi::kMaxValue)); |
| 1606 __ sw(T1, Address(T0, count_offset)); | 1625 __ sw(T1, Address(T0, count_offset)); |
| 1607 | 1626 |
| 1608 __ Bind(&call_target_function); | 1627 __ Bind(&call_target_function); |
| 1609 // T3: Target function. | 1628 // T3: Target function. |
| 1610 __ lw(T3, FieldAddress(T3, Function::code_offset())); | 1629 __ lw(T3, FieldAddress(T3, Function::code_offset())); |
| 1611 __ lw(T3, FieldAddress(T3, Code::instructions_offset())); | 1630 __ lw(T3, FieldAddress(T3, Code::instructions_offset())); |
| 1612 __ AddImmediate(T3, Instructions::HeaderSize() - kHeapObjectTag); | 1631 __ AddImmediate(T3, Instructions::HeaderSize() - kHeapObjectTag); |
| 1613 __ jr(T3); | 1632 __ jr(T3); |
| 1633 __ delay_slot()->addiu(T3, T3, | |
| 1634 Immediate(Instructions::HeaderSize() - kHeapObjectTag)); | |
| 1614 | 1635 |
| 1615 // Instance in T3, return its class-id in T3 as Smi. | 1636 // Instance in T3, return its class-id in T3 as Smi. |
| 1616 __ Bind(&get_class_id_as_smi); | 1637 __ Bind(&get_class_id_as_smi); |
| 1617 Label not_smi; | 1638 Label not_smi; |
| 1618 // Test if Smi -> load Smi class for comparison. | 1639 // Test if Smi -> load Smi class for comparison. |
| 1619 __ andi(TMP1, T3, Immediate(kSmiTagMask)); | 1640 __ andi(TMP1, T3, Immediate(kSmiTagMask)); |
| 1620 __ bne(TMP1, ZR, ¬_smi); | 1641 __ bne(TMP1, ZR, ¬_smi); |
| 1621 __ LoadImmediate(T3, Smi::RawValue(kSmiCid)); | |
| 1622 __ jr(RA); | 1642 __ jr(RA); |
| 1643 __ delay_slot()->addiu(T3, ZR, Immediate(Smi::RawValue(kSmiCid))); | |
| 1623 | 1644 |
| 1624 __ Bind(¬_smi); | 1645 __ Bind(¬_smi); |
| 1625 __ LoadClassId(T3, T3); | 1646 __ LoadClassId(T3, T3); |
| 1626 __ SmiTag(T3); | |
| 1627 __ jr(RA); | 1647 __ jr(RA); |
| 1648 __ delay_slot()->SmiTag(T3); | |
| 1628 } | 1649 } |
| 1629 | 1650 |
| 1630 | 1651 |
| 1631 // Use inline cache data array to invoke the target or continue in inline | 1652 // Use inline cache data array to invoke the target or continue in inline |
| 1632 // cache miss handler. Stub for 1-argument check (receiver class). | 1653 // cache miss handler. Stub for 1-argument check (receiver class). |
| 1633 // RA: Return address. | 1654 // RA: Return address. |
| 1634 // S5: Inline cache data object. | 1655 // S5: Inline cache data object. |
| 1635 // S4: Arguments descriptor array. | 1656 // S4: Arguments descriptor array. |
| 1636 // Inline cache data object structure: | 1657 // Inline cache data object structure: |
| 1637 // 0: function-name | 1658 // 0: function-name |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1699 // Preserve arguments descriptor and make room for result. | 1720 // Preserve arguments descriptor and make room for result. |
| 1700 __ addiu(SP, SP, Immediate(-2 * kWordSize)); | 1721 __ addiu(SP, SP, Immediate(-2 * kWordSize)); |
| 1701 __ sw(S4, Address(SP, 1 * kWordSize)); | 1722 __ sw(S4, Address(SP, 1 * kWordSize)); |
| 1702 __ sw(T0, Address(SP, 0 * kWordSize)); | 1723 __ sw(T0, Address(SP, 0 * kWordSize)); |
| 1703 __ CallRuntime(kBreakpointStaticHandlerRuntimeEntry); | 1724 __ CallRuntime(kBreakpointStaticHandlerRuntimeEntry); |
| 1704 // Pop code object result and restore arguments descriptor. | 1725 // Pop code object result and restore arguments descriptor. |
| 1705 __ lw(T0, Address(SP, 0 * kWordSize)); | 1726 __ lw(T0, Address(SP, 0 * kWordSize)); |
| 1706 __ lw(S4, Address(SP, 1 * kWordSize)); | 1727 __ lw(S4, Address(SP, 1 * kWordSize)); |
| 1707 __ addiu(SP, SP, Immediate(2 * kWordSize)); | 1728 __ addiu(SP, SP, Immediate(2 * kWordSize)); |
| 1708 __ LeaveStubFrame(); | 1729 __ LeaveStubFrame(); |
| 1730 __ LeaveStubFrameSPRestore(); | |
| 1709 | 1731 |
| 1710 // Now call the static function. The breakpoint handler function | 1732 // Now call the static function. The breakpoint handler function |
| 1711 // ensures that the call target is compiled. | 1733 // ensures that the call target is compiled. |
| 1712 __ lw(T0, FieldAddress(T0, Code::instructions_offset())); | 1734 __ lw(T0, FieldAddress(T0, Code::instructions_offset())); |
| 1713 __ AddImmediate(T0, Instructions::HeaderSize() - kHeapObjectTag); | 1735 __ AddImmediate(T0, Instructions::HeaderSize() - kHeapObjectTag); |
| 1714 __ jr(T0); | 1736 __ jr(T0); |
| 1715 } | 1737 } |
| 1716 | 1738 |
| 1717 | 1739 |
| 1718 // V0: return value. | 1740 // V0: return value. |
| 1719 void StubCode::GenerateBreakpointReturnStub(Assembler* assembler) { | 1741 void StubCode::GenerateBreakpointReturnStub(Assembler* assembler) { |
| 1720 __ TraceSimMsg("BreakpoingReturnStub"); | 1742 __ TraceSimMsg("BreakpoingReturnStub"); |
| 1721 // Create a stub frame as we are pushing some objects on the stack before | 1743 // Create a stub frame as we are pushing some objects on the stack before |
| 1722 // calling into the runtime. | 1744 // calling into the runtime. |
| 1723 __ EnterStubFrame(); | 1745 __ EnterStubFrame(); |
| 1724 __ Push(V0); | 1746 __ Push(V0); |
| 1725 __ CallRuntime(kBreakpointReturnHandlerRuntimeEntry); | 1747 __ CallRuntime(kBreakpointReturnHandlerRuntimeEntry); |
| 1726 __ Pop(V0); | 1748 __ Pop(V0); |
| 1727 __ LeaveStubFrame(); | 1749 __ LeaveStubFrame(); |
| 1750 __ LeaveStubFrameSPRestore(); | |
| 1728 | 1751 |
| 1729 // Instead of returning to the patched Dart function, emulate the | 1752 // Instead of returning to the patched Dart function, emulate the |
| 1730 // smashed return code pattern and return to the function's caller. | 1753 // smashed return code pattern and return to the function's caller. |
| 1731 __ LeaveDartFrame(); | 1754 __ LeaveDartFrame(); |
| 1732 __ Ret(); | 1755 __ Ret(); |
| 1733 } | 1756 } |
| 1734 | 1757 |
| 1735 | 1758 |
| 1736 // RA: return address (Dart code). | 1759 // RA: return address (Dart code). |
| 1737 // S5: Inline cache data array. | 1760 // S5: Inline cache data array. |
| 1738 // S4: Arguments descriptor array. | 1761 // S4: Arguments descriptor array. |
| 1739 void StubCode::GenerateBreakpointDynamicStub(Assembler* assembler) { | 1762 void StubCode::GenerateBreakpointDynamicStub(Assembler* assembler) { |
| 1740 // Create a stub frame as we are pushing some objects on the stack before | 1763 // Create a stub frame as we are pushing some objects on the stack before |
| 1741 // calling into the runtime. | 1764 // calling into the runtime. |
| 1742 __ EnterStubFrame(); | 1765 __ EnterStubFrame(); |
| 1743 __ addiu(SP, SP, Immediate(-2 * kWordSize)); | 1766 __ addiu(SP, SP, Immediate(-2 * kWordSize)); |
| 1744 __ sw(S5, Address(SP, 1 * kWordSize)); | 1767 __ sw(S5, Address(SP, 1 * kWordSize)); |
| 1745 __ sw(S4, Address(SP, 0 * kWordSize)); | 1768 __ sw(S4, Address(SP, 0 * kWordSize)); |
| 1746 __ CallRuntime(kBreakpointDynamicHandlerRuntimeEntry); | 1769 __ CallRuntime(kBreakpointDynamicHandlerRuntimeEntry); |
| 1747 __ lw(S4, Address(SP, 0 * kWordSize)); | 1770 __ lw(S4, Address(SP, 0 * kWordSize)); |
| 1748 __ lw(S5, Address(SP, 1 * kWordSize)); | 1771 __ lw(S5, Address(SP, 1 * kWordSize)); |
| 1749 __ addiu(SP, SP, Immediate(2 * kWordSize)); | 1772 __ addiu(SP, SP, Immediate(2 * kWordSize)); |
| 1750 __ LeaveStubFrame(); | 1773 __ LeaveStubFrame(); |
| 1774 __ LeaveStubFrameSPRestore(); | |
| 1751 | 1775 |
| 1752 // Find out which dispatch stub to call. | 1776 // Find out which dispatch stub to call. |
| 1753 __ lw(TMP1, FieldAddress(S5, ICData::num_args_tested_offset())); | 1777 __ lw(TMP1, FieldAddress(S5, ICData::num_args_tested_offset())); |
| 1754 | 1778 |
| 1755 Label one_arg, two_args, three_args; | 1779 Label one_arg, two_args, three_args; |
| 1756 __ BranchEqual(TMP1, 1, &one_arg); | 1780 __ BranchEqual(TMP1, 1, &one_arg); |
| 1757 __ BranchEqual(TMP1, 2, &two_args); | 1781 __ BranchEqual(TMP1, 2, &two_args); |
| 1758 __ BranchEqual(TMP1, 3, &three_args); | 1782 __ BranchEqual(TMP1, 3, &three_args); |
| 1759 __ Stop("Unsupported number of arguments tested."); | 1783 __ Stop("Unsupported number of arguments tested."); |
| 1760 | 1784 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1818 if (n == 2) { | 1842 if (n == 2) { |
| 1819 __ beq(T3, T1, &found); | 1843 __ beq(T3, T1, &found); |
| 1820 } else { | 1844 } else { |
| 1821 __ bne(T3, T1, &next_iteration); | 1845 __ bne(T3, T1, &next_iteration); |
| 1822 __ lw(T3, Address(T2, kWordSize * | 1846 __ lw(T3, Address(T2, kWordSize * |
| 1823 SubtypeTestCache::kInstantiatorTypeArguments)); | 1847 SubtypeTestCache::kInstantiatorTypeArguments)); |
| 1824 __ beq(T3, A1, &found); | 1848 __ beq(T3, A1, &found); |
| 1825 } | 1849 } |
| 1826 } | 1850 } |
| 1827 __ Bind(&next_iteration); | 1851 __ Bind(&next_iteration); |
| 1828 __ AddImmediate(T2, kWordSize * SubtypeTestCache::kTestEntryLength); | |
| 1829 __ b(&loop); | 1852 __ b(&loop); |
| 1853 __ delay_slot()->addiu(T2, T2, | |
| 1854 Immediate(kWordSize * SubtypeTestCache::kTestEntryLength)); | |
| 1830 // Fall through to not found. | 1855 // Fall through to not found. |
| 1831 __ Bind(¬_found); | 1856 __ Bind(¬_found); |
| 1832 __ LoadImmediate(V0, reinterpret_cast<intptr_t>(Object::null())); | 1857 intptr_t null = reinterpret_cast<intptr_t>(Object::null()); |
| 1858 uint16_t null_lo = Utils::Low16Bits(null); | |
| 1859 uint16_t null_hi = Utils::High16Bits(null); | |
| 1860 __ lui(V0, Immediate(null_hi)); | |
| 1833 __ Ret(); | 1861 __ Ret(); |
| 1862 __ delay_slot()->ori(V0, V0, Immediate(null_lo)); | |
| 1834 | 1863 |
| 1835 __ Bind(&found); | 1864 __ Bind(&found); |
| 1836 __ Ret(); | 1865 __ Ret(); |
| 1837 __ delay_slot()->lw(V0, | 1866 __ delay_slot()->lw(V0, |
| 1838 Address(T2, kWordSize * SubtypeTestCache::kTestResult)); | 1867 Address(T2, kWordSize * SubtypeTestCache::kTestResult)); |
| 1839 } | 1868 } |
| 1840 | 1869 |
| 1841 | 1870 |
| 1842 // Used to check class and type arguments. Arguments passed in registers: | 1871 // Used to check class and type arguments. Arguments passed in registers: |
| 1843 // RA: return address. | 1872 // RA: return address. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1886 // A2: frame_pointer. | 1915 // A2: frame_pointer. |
| 1887 // A3: error object. | 1916 // A3: error object. |
| 1888 // SP: address of stacktrace object. | 1917 // SP: address of stacktrace object. |
| 1889 // Does not return. | 1918 // Does not return. |
| 1890 void StubCode::GenerateJumpToExceptionHandlerStub(Assembler* assembler) { | 1919 void StubCode::GenerateJumpToExceptionHandlerStub(Assembler* assembler) { |
| 1891 ASSERT(kExceptionObjectReg == V0); | 1920 ASSERT(kExceptionObjectReg == V0); |
| 1892 ASSERT(kStackTraceObjectReg == V1); | 1921 ASSERT(kStackTraceObjectReg == V1); |
| 1893 __ mov(V0, A3); // Exception object. | 1922 __ mov(V0, A3); // Exception object. |
| 1894 __ lw(V1, Address(SP, 0)); // StackTrace object. | 1923 __ lw(V1, Address(SP, 0)); // StackTrace object. |
| 1895 __ mov(FP, A2); // Frame_pointer. | 1924 __ mov(FP, A2); // Frame_pointer. |
| 1896 __ mov(SP, A1); // Stack pointer. | |
| 1897 __ jr(A0); // Jump to the exception handler code. | 1925 __ jr(A0); // Jump to the exception handler code. |
| 1926 __ delay_slot()->mov(SP, A1); // Stack pointer. | |
| 1898 } | 1927 } |
| 1899 | 1928 |
| 1900 | 1929 |
| 1901 // Implements equality operator when one of the arguments is null | 1930 // Implements equality operator when one of the arguments is null |
| 1902 // (identity check) and updates ICData if necessary. | 1931 // (identity check) and updates ICData if necessary. |
| 1903 // RA: return address. | 1932 // RA: return address. |
| 1904 // A1: left argument. | 1933 // A1: left argument. |
| 1905 // A0: right argument. | 1934 // A0: right argument. |
| 1906 // T0: ICData. | 1935 // T0: ICData. |
| 1907 // V0: result. | 1936 // V0: result. |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 1932 __ lw(T3, Address(T6, 0 * kWordSize)); | 1961 __ lw(T3, Address(T6, 0 * kWordSize)); |
| 1933 __ bne(T2, T3, &no_match); // Class id match? | 1962 __ bne(T2, T3, &no_match); // Class id match? |
| 1934 | 1963 |
| 1935 // Check right. | 1964 // Check right. |
| 1936 __ bal(&get_class_id_as_smi); | 1965 __ bal(&get_class_id_as_smi); |
| 1937 __ delay_slot()->mov(T2, A0); | 1966 __ delay_slot()->mov(T2, A0); |
| 1938 __ lw(T3, Address(T6, 1 * kWordSize)); | 1967 __ lw(T3, Address(T6, 1 * kWordSize)); |
| 1939 __ beq(T2, T3, &found); // Class id match? | 1968 __ beq(T2, T3, &found); // Class id match? |
| 1940 __ Bind(&no_match); | 1969 __ Bind(&no_match); |
| 1941 // Next check group. | 1970 // Next check group. |
| 1942 __ AddImmediate(T6, kWordSize * ICData::TestEntryLengthFor(kNumArgsTested)); | 1971 intptr_t entry_bytes = kWordSize * ICData::TestEntryLengthFor(kNumArgsTested); |
| 1943 __ BranchNotEqual(T3, Smi::RawValue(kIllegalCid), &loop); // Done? | 1972 if (Utils::IsInt(kImmBits, entry_bytes)) { |
| 1973 __ BranchNotEqual(T3, Smi::RawValue(kIllegalCid), &loop); // Done? | |
| 1974 __ delay_slot()->addiu(T6, T6, Immediate(entry_bytes)); | |
| 1975 } else { | |
| 1976 __ AddImmediate(T6, entry_bytes); | |
| 1977 __ BranchNotEqual(T3, Smi::RawValue(kIllegalCid), &loop); // Done? | |
| 1978 } | |
| 1944 | 1979 |
| 1945 Label update_ic_data; | 1980 Label update_ic_data; |
| 1946 __ b(&update_ic_data); | 1981 __ b(&update_ic_data); |
| 1947 | 1982 |
| 1948 __ Bind(&found); | 1983 __ Bind(&found); |
| 1949 const intptr_t count_offset = | 1984 const intptr_t count_offset = |
| 1950 ICData::CountIndexFor(kNumArgsTested) * kWordSize; | 1985 ICData::CountIndexFor(kNumArgsTested) * kWordSize; |
| 1951 Label no_overflow; | 1986 Label no_overflow; |
| 1952 __ lw(T1, Address(T6, count_offset)); | 1987 __ lw(T1, Address(T6, count_offset)); |
| 1953 __ AddImmediateDetectOverflow(T1, T1, Smi::RawValue(1), CMPRES); | 1988 __ AddImmediateDetectOverflow(T1, T1, Smi::RawValue(1), CMPRES); |
| 1954 __ bgez(CMPRES, &no_overflow); | 1989 __ bgez(CMPRES, &no_overflow); |
| 1955 __ LoadImmediate(TMP1, Smi::RawValue(Smi::kMaxValue)); | 1990 __ LoadImmediate(TMP1, Smi::RawValue(Smi::kMaxValue)); |
| 1956 __ sw(TMP1, Address(T6, count_offset)); // If overflow. | 1991 __ sw(TMP1, Address(T6, count_offset)); // If overflow. |
| 1957 __ Bind(&no_overflow); | 1992 __ Bind(&no_overflow); |
| 1958 | 1993 |
| 1959 Label compute_result; | 1994 Label compute_result; |
| 1960 __ Bind(&compute_result); | 1995 __ Bind(&compute_result); |
| 1961 __ LoadObject(TMP1, Bool::True()); | 1996 __ LoadObject(TMP1, Bool::True()); |
| 1962 __ LoadObject(TMP2, Bool::False()); | 1997 __ LoadObject(TMP2, Bool::False()); |
| 1963 __ subu(CMPRES, A0, A1); | 1998 __ subu(CMPRES, A0, A1); |
| 1964 __ movz(V0, TMP1, CMPRES); | 1999 __ movz(V0, TMP1, CMPRES); |
| 1965 __ movn(V0, TMP2, CMPRES); | 2000 __ movn(V0, TMP2, CMPRES); |
| 1966 __ LeaveStubFrame(); | 2001 __ LeaveStubFrame(); |
| 1967 __ Ret(); | 2002 __ Ret(); |
| 2003 __ delay_slot()->LeaveStubFrameSPRestore(); | |
| 1968 | 2004 |
| 1969 __ Bind(&get_class_id_as_smi); | 2005 __ Bind(&get_class_id_as_smi); |
| 1970 // Test if Smi -> load Smi class for comparison. | 2006 // Test if Smi -> load Smi class for comparison. |
| 1971 Label not_smi; | 2007 Label not_smi; |
| 1972 __ andi(CMPRES, T2, Immediate(kSmiTagMask)); | 2008 __ andi(CMPRES, T2, Immediate(kSmiTagMask)); |
| 1973 __ bne(CMPRES, ZR, ¬_smi); | 2009 __ bne(CMPRES, ZR, ¬_smi); |
| 1974 __ jr(RA); | 2010 __ jr(RA); |
| 1975 __ delay_slot()->addiu(T2, ZR, Immediate(Smi::RawValue(kSmiCid))); | 2011 __ delay_slot()->addiu(T2, ZR, Immediate(Smi::RawValue(kSmiCid))); |
| 1976 __ Bind(¬_smi); | 2012 __ Bind(¬_smi); |
| 1977 __ LoadClassId(T2, T2); | 2013 __ LoadClassId(T2, T2); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2009 __ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry); | 2045 __ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry); |
| 2010 __ TraceSimMsg("OptimizeFunctionStub return"); | 2046 __ TraceSimMsg("OptimizeFunctionStub return"); |
| 2011 __ lw(T0, Address(SP, 1 * kWordSize)); // Get Code object | 2047 __ lw(T0, Address(SP, 1 * kWordSize)); // Get Code object |
| 2012 __ lw(S4, Address(SP, 2 * kWordSize)); // Restore argument descriptor. | 2048 __ lw(S4, Address(SP, 2 * kWordSize)); // Restore argument descriptor. |
| 2013 __ addiu(SP, SP, Immediate(3 * kWordSize)); // Discard argument. | 2049 __ addiu(SP, SP, Immediate(3 * kWordSize)); // Discard argument. |
| 2014 | 2050 |
| 2015 __ lw(T0, FieldAddress(T0, Code::instructions_offset())); | 2051 __ lw(T0, FieldAddress(T0, Code::instructions_offset())); |
| 2016 __ AddImmediate(T0, Instructions::HeaderSize() - kHeapObjectTag); | 2052 __ AddImmediate(T0, Instructions::HeaderSize() - kHeapObjectTag); |
| 2017 __ LeaveStubFrame(); | 2053 __ LeaveStubFrame(); |
| 2018 __ jr(T0); | 2054 __ jr(T0); |
| 2055 __ delay_slot()->LeaveStubFrameSPRestore(); | |
| 2019 __ break_(0); | 2056 __ break_(0); |
| 2020 } | 2057 } |
| 2021 | 2058 |
| 2022 | 2059 |
| 2023 DECLARE_LEAF_RUNTIME_ENTRY(intptr_t, | 2060 DECLARE_LEAF_RUNTIME_ENTRY(intptr_t, |
| 2024 BigintCompare, | 2061 BigintCompare, |
| 2025 RawBigint* left, | 2062 RawBigint* left, |
| 2026 RawBigint* right); | 2063 RawBigint* right); |
| 2027 | 2064 |
| 2028 | 2065 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2102 __ bne(ret, ZR, &done); | 2139 __ bne(ret, ZR, &done); |
| 2103 | 2140 |
| 2104 __ EnterStubFrame(0); | 2141 __ EnterStubFrame(0); |
| 2105 __ ReserveAlignedFrameSpace(2 * kWordSize); | 2142 __ ReserveAlignedFrameSpace(2 * kWordSize); |
| 2106 __ sw(T1, Address(SP, 1 * kWordSize)); | 2143 __ sw(T1, Address(SP, 1 * kWordSize)); |
| 2107 __ sw(T0, Address(SP, 0 * kWordSize)); | 2144 __ sw(T0, Address(SP, 0 * kWordSize)); |
| 2108 __ CallRuntime(kBigintCompareRuntimeEntry); | 2145 __ CallRuntime(kBigintCompareRuntimeEntry); |
| 2109 __ TraceSimMsg("IdenticalWithNumberCheckStub return"); | 2146 __ TraceSimMsg("IdenticalWithNumberCheckStub return"); |
| 2110 // Result in V0, 0 means equal. | 2147 // Result in V0, 0 means equal. |
| 2111 __ LeaveStubFrame(); | 2148 __ LeaveStubFrame(); |
| 2149 __ LeaveStubFrameSPRestore(); | |
| 2112 __ b(&done); | 2150 __ b(&done); |
| 2113 __ delay_slot()->mov(CMPRES, V0); | 2151 __ delay_slot()->mov(CMPRES, V0); |
| 2114 | 2152 |
| 2115 __ Bind(&reference_compare); | 2153 __ Bind(&reference_compare); |
| 2116 __ subu(ret, left, right); | 2154 __ subu(ret, left, right); |
| 2117 __ Bind(&done); | 2155 __ Bind(&done); |
| 2118 __ lw(T0, Address(SP, 0 * kWordSize)); | 2156 __ lw(T0, Address(SP, 0 * kWordSize)); |
| 2119 __ lw(T1, Address(SP, 1 * kWordSize)); | 2157 __ lw(T1, Address(SP, 1 * kWordSize)); |
| 2120 __ Ret(); | 2158 __ Ret(); |
| 2121 __ delay_slot()->addiu(SP, SP, Immediate(2 * kWordSize)); | 2159 __ delay_slot()->addiu(SP, SP, Immediate(2 * kWordSize)); |
| 2122 } | 2160 } |
| 2123 | 2161 |
| 2124 } // namespace dart | 2162 } // namespace dart |
| 2125 | 2163 |
| 2126 #endif // defined TARGET_ARCH_MIPS | 2164 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |