| 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 23 matching lines...) Expand all Loading... |
| 215 __ sw(T0, Address(SP, 0 * kWordSize)); | 215 __ sw(T0, Address(SP, 0 * kWordSize)); |
| 216 | 216 |
| 217 __ CallRuntime(kPatchStaticCallRuntimeEntry); | 217 __ CallRuntime(kPatchStaticCallRuntimeEntry); |
| 218 __ TraceSimMsg("CallStaticFunctionStub return"); | 218 __ TraceSimMsg("CallStaticFunctionStub return"); |
| 219 | 219 |
| 220 // Get Code object result and restore arguments descriptor array. | 220 // Get Code object result and restore arguments descriptor array. |
| 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. | |
| 226 __ LeaveStubFrame(); | |
| 227 | |
| 228 __ lw(T0, FieldAddress(T0, Code::instructions_offset())); | 225 __ lw(T0, FieldAddress(T0, Code::instructions_offset())); |
| 229 __ AddImmediate(T0, Instructions::HeaderSize() - kHeapObjectTag); | 226 __ AddImmediate(T0, Instructions::HeaderSize() - kHeapObjectTag); |
| 230 __ jr(T0); | 227 |
| 228 // Remove the stub frame as we are about to jump to the dart function. |
| 229 __ LeaveStubFrameAndReturn(T0); |
| 231 } | 230 } |
| 232 | 231 |
| 233 | 232 |
| 234 // Called from a static call only when an invalid code has been entered | 233 // Called from a static call only when an invalid code has been entered |
| 235 // (invalid because its function was optimized or deoptimized). | 234 // (invalid because its function was optimized or deoptimized). |
| 236 // S4: arguments descriptor array. | 235 // S4: arguments descriptor array. |
| 237 void StubCode::GenerateFixCallersTargetStub(Assembler* assembler) { | 236 void StubCode::GenerateFixCallersTargetStub(Assembler* assembler) { |
| 238 // Create a stub frame as we are pushing some objects on the stack before | 237 // Create a stub frame as we are pushing some objects on the stack before |
| 239 // calling into the runtime. | 238 // calling into the runtime. |
| 240 __ EnterStubFrame(); | 239 __ EnterStubFrame(); |
| 241 // Setup space on stack for return value and preserve arguments descriptor. | 240 // Setup space on stack for return value and preserve arguments descriptor. |
| 242 __ LoadImmediate(T0, reinterpret_cast<intptr_t>(Object::null())); | 241 __ LoadImmediate(T0, reinterpret_cast<intptr_t>(Object::null())); |
| 243 __ addiu(SP, SP, Immediate(-2 * kWordSize)); | 242 __ addiu(SP, SP, Immediate(-2 * kWordSize)); |
| 244 __ sw(S4, Address(SP, 1 * kWordSize)); | 243 __ sw(S4, Address(SP, 1 * kWordSize)); |
| 245 __ sw(T0, Address(SP, 0 * kWordSize)); | 244 __ sw(T0, Address(SP, 0 * kWordSize)); |
| 246 __ CallRuntime(kFixCallersTargetRuntimeEntry); | 245 __ CallRuntime(kFixCallersTargetRuntimeEntry); |
| 247 // Get Code object result and restore arguments descriptor array. | 246 // Get Code object result and restore arguments descriptor array. |
| 248 __ lw(T0, Address(SP, 0 * kWordSize)); | 247 __ lw(T0, Address(SP, 0 * kWordSize)); |
| 249 __ lw(S4, Address(SP, 1 * kWordSize)); | 248 __ lw(S4, Address(SP, 1 * kWordSize)); |
| 250 __ addiu(SP, SP, Immediate(2 * kWordSize)); | 249 __ addiu(SP, SP, Immediate(2 * kWordSize)); |
| 251 // Remove the stub frame. | 250 |
| 252 __ LeaveStubFrame(); | |
| 253 // Jump to the dart function. | 251 // Jump to the dart function. |
| 254 __ lw(T0, FieldAddress(T0, Code::instructions_offset())); | 252 __ lw(T0, FieldAddress(T0, Code::instructions_offset())); |
| 255 __ AddImmediate(T0, T0, Instructions::HeaderSize() - kHeapObjectTag); | 253 __ AddImmediate(T0, T0, Instructions::HeaderSize() - kHeapObjectTag); |
| 256 __ jr(T0); | 254 |
| 255 // Remove the stub frame. |
| 256 __ LeaveStubFrameAndReturn(T0); |
| 257 } | 257 } |
| 258 | 258 |
| 259 | 259 |
| 260 // Input parameters: | 260 // Input parameters: |
| 261 // A1: Smi-tagged argument count, may be zero. | 261 // A1: Smi-tagged argument count, may be zero. |
| 262 // FP[kLastParamSlotIndex]: Last argument. | 262 // FP[kLastParamSlotIndex]: Last argument. |
| 263 static void PushArgumentsArray(Assembler* assembler) { | 263 static void PushArgumentsArray(Assembler* assembler) { |
| 264 __ TraceSimMsg("PushArgumentsArray"); | 264 __ TraceSimMsg("PushArgumentsArray"); |
| 265 // Allocate array to store arguments of caller. | 265 // Allocate array to store arguments of caller. |
| 266 __ LoadImmediate(A0, reinterpret_cast<intptr_t>(Object::null())); | 266 __ LoadImmediate(A0, reinterpret_cast<intptr_t>(Object::null())); |
| 267 // A0: Null element type for raw Array. | 267 // A0: Null element type for raw Array. |
| 268 // A1: Smi-tagged argument count, may be zero. | 268 // A1: Smi-tagged argument count, may be zero. |
| 269 __ BranchLink(&StubCode::AllocateArrayLabel()); | 269 __ BranchLink(&StubCode::AllocateArrayLabel()); |
| 270 __ TraceSimMsg("PushArgumentsArray return"); | 270 __ TraceSimMsg("PushArgumentsArray return"); |
| 271 // V0: newly allocated array. | 271 // V0: newly allocated array. |
| 272 // A1: Smi-tagged argument count, may be zero (was preserved by the stub). | 272 // 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. | 273 __ Push(V0); // Array is in V0 and on top of stack. |
| 274 __ sll(T1, A1, 1); | 274 __ sll(T1, A1, 1); |
| 275 __ addu(T1, FP, T1); | 275 __ addu(T1, FP, T1); |
| 276 __ AddImmediate(T1, (kLastParamSlotIndex - 1) * kWordSize); | 276 __ AddImmediate(T1, (kLastParamSlotIndex - 1) * kWordSize); |
| 277 __ AddImmediate(T2, V0, Array::data_offset() - kHeapObjectTag); | |
| 278 // T1: address of first argument on stack. | 277 // T1: address of first argument on stack. |
| 279 // T2: address of first argument in array. | 278 // T2: address of first argument in array. |
| 280 Label loop, loop_condition; | 279 |
| 281 __ b(&loop_condition); | 280 Label loop, loop_exit; |
| 281 __ blez(A1, &loop_exit); |
| 282 __ delay_slot()->addiu(T2, V0, |
| 283 Immediate(Array::data_offset() - kHeapObjectTag)); |
| 282 __ Bind(&loop); | 284 __ Bind(&loop); |
| 283 __ lw(TMP, Address(T1)); | 285 __ lw(TMP, Address(T1)); |
| 284 __ sw(TMP, Address(T2)); | 286 __ addiu(A1, A1, Immediate(-Smi::RawValue(1))); |
| 285 __ AddImmediate(T1, -kWordSize); | 287 __ addiu(T1, T1, Immediate(-kWordSize)); |
| 286 __ AddImmediate(T2, kWordSize); | 288 __ addiu(T2, T2, Immediate(kWordSize)); |
| 287 __ Bind(&loop_condition); | 289 __ bgez(A1, &loop); |
| 288 __ AddImmediate(A1, -Smi::RawValue(1)); // A1 is Smi. | 290 __ delay_slot()->sw(TMP, Address(T2, -kWordSize)); |
| 289 __ BranchSignedGreaterEqual(A1, ZR, &loop); | 291 __ Bind(&loop_exit); |
| 290 } | 292 } |
| 291 | 293 |
| 292 | 294 |
| 293 // Input parameters: | 295 // Input parameters: |
| 294 // S5: ic-data. | 296 // S5: ic-data. |
| 295 // S4: arguments descriptor array. | 297 // S4: arguments descriptor array. |
| 296 // Note: The receiver object is the first argument to the function being | 298 // Note: The receiver object is the first argument to the function being |
| 297 // called, the stub accesses the receiver from this location directly | 299 // called, the stub accesses the receiver from this location directly |
| 298 // when trying to resolve the call. | 300 // when trying to resolve the call. |
| 299 void StubCode::GenerateInstanceFunctionLookupStub(Assembler* assembler) { | 301 void StubCode::GenerateInstanceFunctionLookupStub(Assembler* assembler) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 326 // TOS + 1: arguments descriptor array. | 328 // TOS + 1: arguments descriptor array. |
| 327 // TOS + 2: IC data object. | 329 // TOS + 2: IC data object. |
| 328 // TOS + 3: Receiver. | 330 // TOS + 3: Receiver. |
| 329 // TOS + 4: place for result from the call. | 331 // TOS + 4: place for result from the call. |
| 330 // TOS + 5: saved FP of previous frame. | 332 // TOS + 5: saved FP of previous frame. |
| 331 // TOS + 6: dart code return address | 333 // TOS + 6: dart code return address |
| 332 // TOS + 7: pc marker (0 for stub). | 334 // TOS + 7: pc marker (0 for stub). |
| 333 // TOS + 8: last argument of caller. | 335 // TOS + 8: last argument of caller. |
| 334 // .... | 336 // .... |
| 335 __ CallRuntime(kInstanceFunctionLookupRuntimeEntry); | 337 __ CallRuntime(kInstanceFunctionLookupRuntimeEntry); |
| 336 // Remove arguments. | 338 |
| 337 __ lw(V0, Address(SP, 4 * kWordSize)); | 339 __ lw(V0, Address(SP, 4 * kWordSize)); // Get result into V0. |
| 338 __ addiu(SP, SP, Immediate(5 * kWordSize)); // Get result into V0. | 340 __ addiu(SP, SP, Immediate(5 * kWordSize)); // Remove arguments. |
| 339 __ LeaveStubFrame(); | 341 |
| 340 __ Ret(); | 342 __ LeaveStubFrameAndReturn(); |
| 341 } | 343 } |
| 342 | 344 |
| 343 | 345 |
| 344 DECLARE_LEAF_RUNTIME_ENTRY(intptr_t, DeoptimizeCopyFrame, | 346 DECLARE_LEAF_RUNTIME_ENTRY(intptr_t, DeoptimizeCopyFrame, |
| 345 intptr_t deopt_reason, | 347 intptr_t deopt_reason, |
| 346 uword saved_registers_address); | 348 uword saved_registers_address); |
| 347 | 349 |
| 348 DECLARE_LEAF_RUNTIME_ENTRY(void, DeoptimizeFillFrame, uword last_fp); | 350 DECLARE_LEAF_RUNTIME_ENTRY(void, DeoptimizeFillFrame, uword last_fp); |
| 349 | 351 |
| 350 | 352 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 // Materialize any objects that were deferred by FillFrame because they | 447 // Materialize any objects that were deferred by FillFrame because they |
| 446 // require allocation. | 448 // require allocation. |
| 447 __ EnterStubFrame(); | 449 __ EnterStubFrame(); |
| 448 if (preserve_result) { | 450 if (preserve_result) { |
| 449 __ Push(T1); // Preserve result, it will be GC-d here. | 451 __ Push(T1); // Preserve result, it will be GC-d here. |
| 450 } | 452 } |
| 451 __ CallRuntime(kDeoptimizeMaterializeDoublesRuntimeEntry); | 453 __ CallRuntime(kDeoptimizeMaterializeDoublesRuntimeEntry); |
| 452 if (preserve_result) { | 454 if (preserve_result) { |
| 453 __ Pop(V0); // Restore result. | 455 __ Pop(V0); // Restore result. |
| 454 } | 456 } |
| 455 __ LeaveStubFrame(); | 457 |
| 456 __ Ret(); | 458 __ LeaveStubFrameAndReturn(); |
| 457 } | 459 } |
| 458 | 460 |
| 459 | 461 |
| 460 void StubCode::GenerateDeoptimizeLazyStub(Assembler* assembler) { | 462 void StubCode::GenerateDeoptimizeLazyStub(Assembler* assembler) { |
| 461 __ Unimplemented("DeoptimizeLazy stub"); | 463 __ Unimplemented("DeoptimizeLazy stub"); |
| 462 } | 464 } |
| 463 | 465 |
| 464 | 466 |
| 465 void StubCode::GenerateDeoptimizeStub(Assembler* assembler) { | 467 void StubCode::GenerateDeoptimizeStub(Assembler* assembler) { |
| 466 GenerateDeoptimizationSequence(assembler, false); // Don't preserve V0. | 468 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. | 565 // Get the class index and insert it into the tags. |
| 564 __ LoadImmediate(TMP1, RawObject::ClassIdTag::encode(kArrayCid)); | 566 __ LoadImmediate(TMP1, RawObject::ClassIdTag::encode(kArrayCid)); |
| 565 __ or_(T3, T3, TMP1); | 567 __ or_(T3, T3, TMP1); |
| 566 __ sw(T3, FieldAddress(V0, Array::tags_offset())); | 568 __ sw(T3, FieldAddress(V0, Array::tags_offset())); |
| 567 | 569 |
| 568 // Initialize all array elements to raw_null. | 570 // Initialize all array elements to raw_null. |
| 569 // V0: new object start as a tagged pointer. | 571 // V0: new object start as a tagged pointer. |
| 570 // T2: new object end address. | 572 // T2: new object end address. |
| 571 // A1: Array length as Smi. | 573 // A1: Array length as Smi. |
| 572 __ AddImmediate(T3, V0, Array::data_offset() - kHeapObjectTag); | 574 __ AddImmediate(T3, V0, Array::data_offset() - kHeapObjectTag); |
| 573 // R1: iterator which initially points to the start of the variable | 575 // T3: iterator which initially points to the start of the variable |
| 574 // data area to be initialized. | 576 // data area to be initialized. |
| 575 __ LoadImmediate(TMP1, reinterpret_cast<intptr_t>(Object::null())); | 577 |
| 576 Label loop, test; | 578 Label loop, loop_exit; |
| 577 __ b(&test); | 579 intptr_t null = reinterpret_cast<intptr_t>(Object::null()); |
| 580 uint16_t null_lo = Utils::Low16Bits(null); |
| 581 uint16_t null_hi = Utils::High16Bits(null); |
| 582 __ lui(TMP1, Immediate(null_hi)); |
| 583 __ BranchUnsignedGreaterEqual(T3, T2, &loop_exit); |
| 584 __ delay_slot()->ori(TMP1, TMP1, Immediate(null_lo)); |
| 578 __ Bind(&loop); | 585 __ Bind(&loop); |
| 579 // TODO(cshapiro): StoreIntoObjectNoBarrier | 586 __ addiu(T3, T3, Immediate(kWordSize)); |
| 580 __ sw(TMP1, Address(T3, 0)); | |
| 581 __ AddImmediate(T3, kWordSize); | |
| 582 __ Bind(&test); | |
| 583 __ bne(T3, T2, &loop); | 587 __ bne(T3, T2, &loop); |
| 588 __ delay_slot()->sw(TMP1, Address(T3, -kWordSize)); |
| 589 __ Bind(&loop_exit); |
| 584 | 590 |
| 585 // Done allocating and initializing the array. | 591 // Done allocating and initializing the array. |
| 586 // V0: new object. | 592 // V0: new object. |
| 587 // A1: Array length as Smi (preserved for the caller.) | 593 // A1: Array length as Smi (preserved for the caller.) |
| 588 __ Ret(); | 594 __ Ret(); |
| 589 } | 595 } |
| 590 | 596 |
| 591 // Unable to allocate the array using the fast inline code, just call | 597 // Unable to allocate the array using the fast inline code, just call |
| 592 // into the runtime. | 598 // into the runtime. |
| 593 __ Bind(&slow_case); | 599 __ Bind(&slow_case); |
| 594 // Create a stub frame as we are pushing some objects on the stack before | 600 // Create a stub frame as we are pushing some objects on the stack before |
| 595 // calling into the runtime. | 601 // calling into the runtime. |
| 596 __ EnterStubFrame(); | 602 __ EnterStubFrame(); |
| 597 __ LoadImmediate(TMP1, reinterpret_cast<intptr_t>(Object::null())); | 603 __ LoadImmediate(TMP1, reinterpret_cast<intptr_t>(Object::null())); |
| 598 // Setup space on stack for return value. | 604 // Setup space on stack for return value. |
| 599 // Push array length as Smi and element type. | 605 // Push array length as Smi and element type. |
| 600 __ addiu(SP, SP, Immediate(-3 * kWordSize)); | 606 __ addiu(SP, SP, Immediate(-3 * kWordSize)); |
| 601 __ sw(TMP1, Address(SP, 2 * kWordSize)); | 607 __ sw(TMP1, Address(SP, 2 * kWordSize)); |
| 602 __ sw(A1, Address(SP, 1 * kWordSize)); | 608 __ sw(A1, Address(SP, 1 * kWordSize)); |
| 603 __ sw(T3, Address(SP, 0 * kWordSize)); | 609 __ sw(T3, Address(SP, 0 * kWordSize)); |
| 604 __ CallRuntime(kAllocateArrayRuntimeEntry); | 610 __ CallRuntime(kAllocateArrayRuntimeEntry); |
| 605 __ TraceSimMsg("AllocateArrayStub return"); | 611 __ TraceSimMsg("AllocateArrayStub return"); |
| 606 // Pop arguments; result is popped in IP. | 612 // Pop arguments; result is popped in IP. |
| 607 __ lw(TMP1, Address(SP, 2 * kWordSize)); | 613 __ lw(TMP1, Address(SP, 2 * kWordSize)); |
| 608 __ lw(A1, Address(SP, 1 * kWordSize)); | 614 __ lw(A1, Address(SP, 1 * kWordSize)); |
| 609 __ lw(T3, Address(SP, 0 * kWordSize)); | 615 __ lw(T3, Address(SP, 0 * kWordSize)); |
| 610 __ addiu(SP, SP, Immediate(3 * kWordSize)); | 616 __ addiu(SP, SP, Immediate(3 * kWordSize)); |
| 611 __ mov(V0, TMP1); | 617 __ mov(V0, TMP1); |
| 612 __ LeaveStubFrame(); | 618 |
| 613 __ Ret(); | 619 __ LeaveStubFrameAndReturn(); |
| 614 } | 620 } |
| 615 | 621 |
| 616 | 622 |
| 617 // Input parameters: | 623 // Input parameters: |
| 618 // RA: return address. | 624 // RA: return address. |
| 619 // SP: address of last argument. | 625 // SP: address of last argument. |
| 620 // S4: Arguments descriptor array. | 626 // S4: Arguments descriptor array. |
| 621 // Return: V0. | 627 // Return: V0. |
| 622 // Note: The closure object is the first argument to the function being | 628 // Note: The closure object is the first argument to the function being |
| 623 // called, the stub accesses the closure from this location directly | 629 // called, the stub accesses the closure from this location directly |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 // TOS + 3: Saved FP of previous frame. | 724 // TOS + 3: Saved FP of previous frame. |
| 719 // TOS + 4: Dart code return address. | 725 // TOS + 4: Dart code return address. |
| 720 // TOS + 5: PC marker (0 for stub). | 726 // TOS + 5: PC marker (0 for stub). |
| 721 // TOS + 6: Last argument of caller. | 727 // TOS + 6: Last argument of caller. |
| 722 // .... | 728 // .... |
| 723 __ CallRuntime(kInvokeNonClosureRuntimeEntry); | 729 __ CallRuntime(kInvokeNonClosureRuntimeEntry); |
| 724 __ lw(V0, Address(SP, 2 * kWordSize)); // Get result into V0. | 730 __ lw(V0, Address(SP, 2 * kWordSize)); // Get result into V0. |
| 725 __ addiu(SP, SP, Immediate(3 * kWordSize)); // Remove arguments. | 731 __ addiu(SP, SP, Immediate(3 * kWordSize)); // Remove arguments. |
| 726 | 732 |
| 727 // Remove the stub frame as we are about to return. | 733 // Remove the stub frame as we are about to return. |
| 728 __ LeaveStubFrame(); | 734 __ LeaveStubFrameAndReturn(); |
| 729 __ Ret(); | |
| 730 } | 735 } |
| 731 | 736 |
| 732 | 737 |
| 733 // Called when invoking Dart code from C++ (VM code). | 738 // Called when invoking Dart code from C++ (VM code). |
| 734 // Input parameters: | 739 // Input parameters: |
| 735 // RA : points to return address. | 740 // RA : points to return address. |
| 736 // A0 : entrypoint of the Dart function to call. | 741 // A0 : entrypoint of the Dart function to call. |
| 737 // A1 : arguments descriptor array. | 742 // A1 : arguments descriptor array. |
| 738 // A2 : arguments array. | 743 // A2 : arguments array. |
| 739 // A3 : new context containing the current isolate pointer. | 744 // A3 : new context containing the current isolate pointer. |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 788 | 793 |
| 789 // Load arguments descriptor array into S4, which is passed to Dart code. | 794 // Load arguments descriptor array into S4, which is passed to Dart code. |
| 790 __ lw(S4, Address(A1, VMHandles::kOffsetOfRawPtrInHandle)); | 795 __ lw(S4, Address(A1, VMHandles::kOffsetOfRawPtrInHandle)); |
| 791 | 796 |
| 792 // Load number of arguments into S5. | 797 // Load number of arguments into S5. |
| 793 __ lw(T1, FieldAddress(S4, ArgumentsDescriptor::count_offset())); | 798 __ lw(T1, FieldAddress(S4, ArgumentsDescriptor::count_offset())); |
| 794 __ SmiUntag(T1); | 799 __ SmiUntag(T1); |
| 795 | 800 |
| 796 // Compute address of 'arguments array' data area into A2. | 801 // Compute address of 'arguments array' data area into A2. |
| 797 __ lw(A2, Address(A2, VMHandles::kOffsetOfRawPtrInHandle)); | 802 __ lw(A2, Address(A2, VMHandles::kOffsetOfRawPtrInHandle)); |
| 798 __ AddImmediate(A2, Array::data_offset() - kHeapObjectTag); | |
| 799 | 803 |
| 800 // Set up arguments for the Dart call. | 804 // Set up arguments for the Dart call. |
| 801 Label push_arguments; | 805 Label push_arguments; |
| 802 Label done_push_arguments; | 806 Label done_push_arguments; |
| 803 __ beq(T1, ZR, &done_push_arguments); // check if there are arguments. | 807 __ beq(T1, ZR, &done_push_arguments); // check if there are arguments. |
| 808 __ delay_slot()->addiu(A2, A2, |
| 809 Immediate(Array::data_offset() - kHeapObjectTag)); |
| 804 __ mov(A1, ZR); | 810 __ mov(A1, ZR); |
| 805 __ Bind(&push_arguments); | 811 __ Bind(&push_arguments); |
| 806 __ lw(A3, Address(A2)); | 812 __ lw(A3, Address(A2)); |
| 807 __ Push(A3); | 813 __ Push(A3); |
| 808 __ addiu(A1, A1, Immediate(1)); | 814 __ addiu(A1, A1, Immediate(1)); |
| 809 __ BranchSignedLess(A1, T1, &push_arguments); | 815 __ BranchSignedLess(A1, T1, &push_arguments); |
| 810 __ delay_slot()->addiu(A2, A2, Immediate(kWordSize)); | 816 __ delay_slot()->addiu(A2, A2, Immediate(kWordSize)); |
| 811 | 817 |
| 812 __ Bind(&done_push_arguments); | 818 __ Bind(&done_push_arguments); |
| 813 | 819 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 836 | 842 |
| 837 // Restore C++ ABI callee-saved registers. | 843 // Restore C++ ABI callee-saved registers. |
| 838 for (int i = S0; i <= S7; i++) { | 844 for (int i = S0; i <= S7; i++) { |
| 839 Register r = static_cast<Register>(i); | 845 Register r = static_cast<Register>(i); |
| 840 __ lw(r, Address(SP, (i - S0 + 3) * kWordSize)); | 846 __ lw(r, Address(SP, (i - S0 + 3) * kWordSize)); |
| 841 } | 847 } |
| 842 __ lw(A3, Address(SP, 2 * kWordSize)); | 848 __ lw(A3, Address(SP, 2 * kWordSize)); |
| 843 __ addiu(SP, SP, Immediate((3 + kAbiPreservedCpuRegCount) * kWordSize)); | 849 __ addiu(SP, SP, Immediate((3 + kAbiPreservedCpuRegCount) * kWordSize)); |
| 844 | 850 |
| 845 // Restore the frame pointer and return. | 851 // Restore the frame pointer and return. |
| 846 __ LeaveStubFrame(); | 852 __ LeaveStubFrameAndReturn(); |
| 847 __ Ret(); | |
| 848 } | 853 } |
| 849 | 854 |
| 850 | 855 |
| 851 // Called for inline allocation of contexts. | 856 // Called for inline allocation of contexts. |
| 852 // Input: | 857 // Input: |
| 853 // T1: number of context variables. | 858 // T1: number of context variables. |
| 854 // Output: | 859 // Output: |
| 855 // V0: new allocated RawContext object. | 860 // V0: new allocated RawContext object. |
| 856 void StubCode::GenerateAllocateContextStub(Assembler* assembler) { | 861 void StubCode::GenerateAllocateContextStub(Assembler* assembler) { |
| 857 if (FLAG_inline_alloc) { | 862 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())); | 925 __ sw(T1, FieldAddress(V0, Context::num_variables_offset())); |
| 921 | 926 |
| 922 // Setup isolate field. | 927 // Setup isolate field. |
| 923 // Load Isolate pointer from Context structure into R2. | 928 // Load Isolate pointer from Context structure into R2. |
| 924 // V0: new object. | 929 // V0: new object. |
| 925 // T1: number of context variables. | 930 // T1: number of context variables. |
| 926 __ lw(T2, FieldAddress(CTX, Context::isolate_offset())); | 931 __ lw(T2, FieldAddress(CTX, Context::isolate_offset())); |
| 927 // T2: isolate, not an object. | 932 // T2: isolate, not an object. |
| 928 __ sw(T2, FieldAddress(V0, Context::isolate_offset())); | 933 __ sw(T2, FieldAddress(V0, Context::isolate_offset())); |
| 929 | 934 |
| 930 // Setup the parent field. | |
| 931 // V0: new object. | |
| 932 // T1: number of context variables. | |
| 933 __ LoadImmediate(T2, reinterpret_cast<intptr_t>(Object::null())); | 935 __ LoadImmediate(T2, reinterpret_cast<intptr_t>(Object::null())); |
| 934 __ sw(T2, FieldAddress(V0, Context::parent_offset())); | |
| 935 | 936 |
| 936 // Initialize the context variables. | 937 // Initialize the context variables. |
| 937 // V0: new object. | 938 // V0: new object. |
| 938 // T1: number of context variables. | 939 // T1: number of context variables. |
| 939 // T2: raw null. | 940 // T2: raw null. |
| 940 Label loop, loop_test; | 941 Label loop, loop_exit; |
| 942 __ blez(T1, &loop_exit); |
| 943 // Setup the parent field. |
| 944 __ delay_slot()->sw(T2, FieldAddress(V0, Context::parent_offset())); |
| 941 __ AddImmediate(T3, V0, Context::variable_offset(0) - kHeapObjectTag); | 945 __ AddImmediate(T3, V0, Context::variable_offset(0) - kHeapObjectTag); |
| 942 __ b(&loop_test); | 946 __ sll(T1, T1, 2); |
| 943 __ delay_slot()->sll(T1, T1, 2); | |
| 944 __ Bind(&loop); | 947 __ Bind(&loop); |
| 948 __ addiu(T1, T1, Immediate(-kWordSize)); |
| 945 __ addu(TMP1, T3, T1); | 949 __ addu(TMP1, T3, T1); |
| 946 __ sw(T2, Address(TMP1)); | 950 __ bgtz(T1, &loop); |
| 947 __ Bind(&loop_test); | 951 __ delay_slot()->sw(T2, Address(TMP1)); |
| 948 __ addiu(T1, T1, Immediate(-kWordSize)); | 952 __ Bind(&loop_exit); |
| 949 __ bne(T1, ZR, &loop); // Loop if R1 not zero. | |
| 950 | 953 |
| 951 // Done allocating and initializing the context. | 954 // Done allocating and initializing the context. |
| 952 // V0: new object. | 955 // V0: new object. |
| 953 __ Ret(); | 956 __ Ret(); |
| 954 | 957 |
| 955 __ Bind(&slow_case); | 958 __ Bind(&slow_case); |
| 956 } | 959 } |
| 957 // Create a stub frame as we are pushing some objects on the stack before | 960 // Create a stub frame as we are pushing some objects on the stack before |
| 958 // calling into the runtime. | 961 // calling into the runtime. |
| 959 __ EnterStubFrame(); | 962 __ EnterStubFrame(); |
| 960 // Setup space on stack for return value. | 963 // Setup space on stack for return value. |
| 961 __ LoadImmediate(T2, reinterpret_cast<intptr_t>(Object::null())); | 964 __ LoadImmediate(T2, reinterpret_cast<intptr_t>(Object::null())); |
| 962 __ SmiTag(T1); | 965 __ SmiTag(T1); |
| 963 __ addiu(SP, SP, Immediate(-2 * kWordSize)); | 966 __ addiu(SP, SP, Immediate(-2 * kWordSize)); |
| 964 __ sw(T2, Address(SP, 1 * kWordSize)); | 967 __ sw(T2, Address(SP, 1 * kWordSize)); |
| 965 __ sw(T1, Address(SP, 0 * kWordSize)); | 968 __ sw(T1, Address(SP, 0 * kWordSize)); |
| 966 __ CallRuntime(kAllocateContextRuntimeEntry); // Allocate context. | 969 __ CallRuntime(kAllocateContextRuntimeEntry); // Allocate context. |
| 967 __ lw(V0, Address(SP, 1 * kWordSize)); // Get the new context. | 970 __ lw(V0, Address(SP, 1 * kWordSize)); // Get the new context. |
| 968 __ addiu(SP, SP, Immediate(2 * kWordSize)); // Pop argument and return. | 971 __ addiu(SP, SP, Immediate(2 * kWordSize)); // Pop argument and return. |
| 969 | 972 |
| 970 // V0: new object | 973 // V0: new object |
| 971 // Restore the frame pointer. | 974 // Restore the frame pointer. |
| 972 __ LeaveStubFrame(); | 975 __ LeaveStubFrameAndReturn(); |
| 973 __ Ret(); | |
| 974 } | 976 } |
| 975 | 977 |
| 976 | 978 |
| 977 DECLARE_LEAF_RUNTIME_ENTRY(void, StoreBufferBlockProcess, Isolate* isolate); | 979 DECLARE_LEAF_RUNTIME_ENTRY(void, StoreBufferBlockProcess, Isolate* isolate); |
| 978 | 980 |
| 979 | 981 |
| 980 // Helper stub to implement Assembler::StoreIntoObject. | 982 // Helper stub to implement Assembler::StoreIntoObject. |
| 981 // Input parameters: | 983 // Input parameters: |
| 982 // T0: Address (i.e. object) being stored into. | 984 // T0: Address (i.e. object) being stored into. |
| 983 void StubCode::GenerateUpdateStoreBufferStub(Assembler* assembler) { | 985 void StubCode::GenerateUpdateStoreBufferStub(Assembler* assembler) { |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1145 __ sw(T0, Address(T2, current_offset)); | 1147 __ sw(T0, Address(T2, current_offset)); |
| 1146 } | 1148 } |
| 1147 } else { | 1149 } else { |
| 1148 __ addiu(T4, T2, Immediate(sizeof(RawObject))); | 1150 __ addiu(T4, T2, Immediate(sizeof(RawObject))); |
| 1149 // Loop until the whole object is initialized. | 1151 // Loop until the whole object is initialized. |
| 1150 // T0: raw null. | 1152 // T0: raw null. |
| 1151 // T2: new object. | 1153 // T2: new object. |
| 1152 // T3: next object start. | 1154 // T3: next object start. |
| 1153 // T4: next word to be initialized. | 1155 // T4: next word to be initialized. |
| 1154 // T1: new object type arguments (if is_cls_parameterized). | 1156 // T1: new object type arguments (if is_cls_parameterized). |
| 1155 Label init_loop; | 1157 Label loop, loop_exit; |
| 1156 Label done; | 1158 __ BranchUnsignedGreaterEqual(T4, T3, &loop_exit); |
| 1157 __ Bind(&init_loop); | 1159 __ Bind(&loop); |
| 1158 __ BranchUnsignedGreaterEqual(T4, T3, &done); // Done if T4 >= T3. | 1160 __ addiu(T4, T4, Immediate(kWordSize)); |
| 1159 __ sw(T0, Address(T4)); | 1161 __ bne(T4, T3, &loop); |
| 1160 __ AddImmediate(T4, kWordSize); | 1162 __ delay_slot()->sw(T0, Address(T4, -kWordSize)); |
| 1161 __ b(&init_loop); | 1163 __ Bind(&loop_exit); |
| 1162 __ Bind(&done); | |
| 1163 } | 1164 } |
| 1164 if (is_cls_parameterized) { | 1165 if (is_cls_parameterized) { |
| 1165 // R1: new object type arguments. | 1166 // R1: new object type arguments. |
| 1166 // Set the type arguments in the new object. | 1167 // Set the type arguments in the new object. |
| 1167 __ sw(T1, Address(T2, cls.type_arguments_field_offset())); | 1168 __ sw(T1, Address(T2, cls.type_arguments_field_offset())); |
| 1168 } | 1169 } |
| 1169 // Done allocating and initializing the instance. | 1170 // Done allocating and initializing the instance. |
| 1170 // T2: new object still missing its heap tag. | 1171 // T2: new object still missing its heap tag. |
| 1171 __ Ret(); | 1172 __ Ret(); |
| 1172 __ delay_slot()->addiu(V0, T2, Immediate(kHeapObjectTag)); | 1173 __ delay_slot()->addiu(V0, T2, Immediate(kHeapObjectTag)); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1196 __ LoadImmediate(T1, Smi::RawValue(StubCode::kNoInstantiator)); | 1197 __ LoadImmediate(T1, Smi::RawValue(StubCode::kNoInstantiator)); |
| 1197 __ sw(T2, Address(SP, 1 * kWordSize)); | 1198 __ sw(T2, Address(SP, 1 * kWordSize)); |
| 1198 __ sw(T1, Address(SP, 0 * kWordSize)); | 1199 __ sw(T1, Address(SP, 0 * kWordSize)); |
| 1199 } | 1200 } |
| 1200 __ CallRuntime(kAllocateObjectRuntimeEntry); // Allocate object. | 1201 __ CallRuntime(kAllocateObjectRuntimeEntry); // Allocate object. |
| 1201 __ TraceSimMsg("AllocationStubForClass return"); | 1202 __ TraceSimMsg("AllocationStubForClass return"); |
| 1202 // Pop result (newly allocated object). | 1203 // Pop result (newly allocated object). |
| 1203 __ lw(V0, Address(SP, 3 * kWordSize)); | 1204 __ lw(V0, Address(SP, 3 * kWordSize)); |
| 1204 __ addiu(SP, SP, Immediate(4 * kWordSize)); // Pop arguments. | 1205 __ addiu(SP, SP, Immediate(4 * kWordSize)); // Pop arguments. |
| 1205 // V0: new object | 1206 // V0: new object |
| 1206 // Restore the frame pointer. | 1207 // Restore the frame pointer and return. |
| 1207 __ LeaveStubFrame(true); | 1208 __ LeaveStubFrameAndReturn(RA, true); |
| 1208 __ Ret(); | |
| 1209 } | 1209 } |
| 1210 | 1210 |
| 1211 | 1211 |
| 1212 // Called for inline allocation of closures. | 1212 // Called for inline allocation of closures. |
| 1213 // Input parameters: | 1213 // Input parameters: |
| 1214 // RA: return address. | 1214 // RA: return address. |
| 1215 // SP + 4 : receiver (null if not an implicit instance closure). | 1215 // SP + 4 : receiver (null if not an implicit instance closure). |
| 1216 // SP + 0 : type arguments object (null if class is no parameterized). | 1216 // SP + 0 : type arguments object (null if class is no parameterized). |
| 1217 void StubCode::GenerateAllocationStubForClosure(Assembler* assembler, | 1217 void StubCode::GenerateAllocationStubForClosure(Assembler* assembler, |
| 1218 const Function& func) { | 1218 const Function& func) { |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1313 __ sw(CTX, Address(T2, Closure::context_offset())); | 1313 __ sw(CTX, Address(T2, Closure::context_offset())); |
| 1314 } | 1314 } |
| 1315 | 1315 |
| 1316 // Set the type arguments field in the newly allocated closure. | 1316 // Set the type arguments field in the newly allocated closure. |
| 1317 __ lw(T0, Address(FP, kTypeArgumentsFPOffset)); | 1317 __ lw(T0, Address(FP, kTypeArgumentsFPOffset)); |
| 1318 __ sw(T0, Address(T2, Closure::type_arguments_offset())); | 1318 __ sw(T0, Address(T2, Closure::type_arguments_offset())); |
| 1319 | 1319 |
| 1320 // Done allocating and initializing the instance. | 1320 // Done allocating and initializing the instance. |
| 1321 // V0: new object. | 1321 // V0: new object. |
| 1322 __ addiu(V0, T2, Immediate(kHeapObjectTag)); | 1322 __ addiu(V0, T2, Immediate(kHeapObjectTag)); |
| 1323 __ LeaveStubFrame(true); | 1323 |
| 1324 __ Ret(); | 1324 __ LeaveStubFrameAndReturn(RA, true); |
| 1325 | 1325 |
| 1326 __ Bind(&slow_case); | 1326 __ Bind(&slow_case); |
| 1327 } | 1327 } |
| 1328 | 1328 |
| 1329 // If it's an implicit static closure we need 2 stack slots. Otherwise, | 1329 // 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. | 1330 // If it's an implicit instance closure we need 4 stack slots, o/w only 3. |
| 1331 int num_slots = 2; | 1331 int num_slots = 2; |
| 1332 if (!is_implicit_static_closure) { | 1332 if (!is_implicit_static_closure) { |
| 1333 num_slots = is_implicit_instance_closure ? 4 : 3; | 1333 num_slots = is_implicit_instance_closure ? 4 : 3; |
| 1334 } | 1334 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1360 ASSERT(func.IsNonImplicitClosureFunction()); | 1360 ASSERT(func.IsNonImplicitClosureFunction()); |
| 1361 __ CallRuntime(kAllocateClosureRuntimeEntry); | 1361 __ CallRuntime(kAllocateClosureRuntimeEntry); |
| 1362 __ TraceSimMsg("AllocationStubForClosure return"); | 1362 __ TraceSimMsg("AllocationStubForClosure return"); |
| 1363 } | 1363 } |
| 1364 } | 1364 } |
| 1365 __ lw(V0, Address(SP, (num_slots - 1) * kWordSize)); // Pop function object. | 1365 __ lw(V0, Address(SP, (num_slots - 1) * kWordSize)); // Pop function object. |
| 1366 __ addiu(SP, SP, Immediate(num_slots * kWordSize)); | 1366 __ addiu(SP, SP, Immediate(num_slots * kWordSize)); |
| 1367 | 1367 |
| 1368 // V0: new object | 1368 // V0: new object |
| 1369 // Restore the frame pointer. | 1369 // Restore the frame pointer. |
| 1370 __ LeaveStubFrame(true); | 1370 __ LeaveStubFrameAndReturn(RA, true); |
| 1371 __ Ret(); | |
| 1372 } | 1371 } |
| 1373 | 1372 |
| 1374 | 1373 |
| 1375 void StubCode::GenerateCallNoSuchMethodFunctionStub(Assembler* assembler) { | 1374 void StubCode::GenerateCallNoSuchMethodFunctionStub(Assembler* assembler) { |
| 1376 __ Unimplemented("CallNoSuchMethodFunction stub"); | 1375 __ Unimplemented("CallNoSuchMethodFunction stub"); |
| 1377 } | 1376 } |
| 1378 | 1377 |
| 1379 | 1378 |
| 1380 // T0: function object. | 1379 // T0: function object. |
| 1381 // S5: inline cache data object. | 1380 // S5: inline cache data object. |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1604 | 1603 |
| 1605 __ LoadImmediate(T1, Smi::RawValue(Smi::kMaxValue)); | 1604 __ LoadImmediate(T1, Smi::RawValue(Smi::kMaxValue)); |
| 1606 __ sw(T1, Address(T0, count_offset)); | 1605 __ sw(T1, Address(T0, count_offset)); |
| 1607 | 1606 |
| 1608 __ Bind(&call_target_function); | 1607 __ Bind(&call_target_function); |
| 1609 // T3: Target function. | 1608 // T3: Target function. |
| 1610 __ lw(T3, FieldAddress(T3, Function::code_offset())); | 1609 __ lw(T3, FieldAddress(T3, Function::code_offset())); |
| 1611 __ lw(T3, FieldAddress(T3, Code::instructions_offset())); | 1610 __ lw(T3, FieldAddress(T3, Code::instructions_offset())); |
| 1612 __ AddImmediate(T3, Instructions::HeaderSize() - kHeapObjectTag); | 1611 __ AddImmediate(T3, Instructions::HeaderSize() - kHeapObjectTag); |
| 1613 __ jr(T3); | 1612 __ jr(T3); |
| 1613 __ delay_slot()->addiu(T3, T3, |
| 1614 Immediate(Instructions::HeaderSize() - kHeapObjectTag)); |
| 1614 | 1615 |
| 1615 // Instance in T3, return its class-id in T3 as Smi. | 1616 // Instance in T3, return its class-id in T3 as Smi. |
| 1616 __ Bind(&get_class_id_as_smi); | 1617 __ Bind(&get_class_id_as_smi); |
| 1617 Label not_smi; | 1618 Label not_smi; |
| 1618 // Test if Smi -> load Smi class for comparison. | 1619 // Test if Smi -> load Smi class for comparison. |
| 1619 __ andi(TMP1, T3, Immediate(kSmiTagMask)); | 1620 __ andi(TMP1, T3, Immediate(kSmiTagMask)); |
| 1620 __ bne(TMP1, ZR, ¬_smi); | 1621 __ bne(TMP1, ZR, ¬_smi); |
| 1621 __ LoadImmediate(T3, Smi::RawValue(kSmiCid)); | |
| 1622 __ jr(RA); | 1622 __ jr(RA); |
| 1623 __ delay_slot()->addiu(T3, ZR, Immediate(Smi::RawValue(kSmiCid))); |
| 1623 | 1624 |
| 1624 __ Bind(¬_smi); | 1625 __ Bind(¬_smi); |
| 1625 __ LoadClassId(T3, T3); | 1626 __ LoadClassId(T3, T3); |
| 1626 __ SmiTag(T3); | |
| 1627 __ jr(RA); | 1627 __ jr(RA); |
| 1628 __ delay_slot()->SmiTag(T3); |
| 1628 } | 1629 } |
| 1629 | 1630 |
| 1630 | 1631 |
| 1631 // Use inline cache data array to invoke the target or continue in inline | 1632 // Use inline cache data array to invoke the target or continue in inline |
| 1632 // cache miss handler. Stub for 1-argument check (receiver class). | 1633 // cache miss handler. Stub for 1-argument check (receiver class). |
| 1633 // RA: Return address. | 1634 // RA: Return address. |
| 1634 // S5: Inline cache data object. | 1635 // S5: Inline cache data object. |
| 1635 // S4: Arguments descriptor array. | 1636 // S4: Arguments descriptor array. |
| 1636 // Inline cache data object structure: | 1637 // Inline cache data object structure: |
| 1637 // 0: function-name | 1638 // 0: function-name |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1818 if (n == 2) { | 1819 if (n == 2) { |
| 1819 __ beq(T3, T1, &found); | 1820 __ beq(T3, T1, &found); |
| 1820 } else { | 1821 } else { |
| 1821 __ bne(T3, T1, &next_iteration); | 1822 __ bne(T3, T1, &next_iteration); |
| 1822 __ lw(T3, Address(T2, kWordSize * | 1823 __ lw(T3, Address(T2, kWordSize * |
| 1823 SubtypeTestCache::kInstantiatorTypeArguments)); | 1824 SubtypeTestCache::kInstantiatorTypeArguments)); |
| 1824 __ beq(T3, A1, &found); | 1825 __ beq(T3, A1, &found); |
| 1825 } | 1826 } |
| 1826 } | 1827 } |
| 1827 __ Bind(&next_iteration); | 1828 __ Bind(&next_iteration); |
| 1828 __ AddImmediate(T2, kWordSize * SubtypeTestCache::kTestEntryLength); | |
| 1829 __ b(&loop); | 1829 __ b(&loop); |
| 1830 __ delay_slot()->addiu(T2, T2, |
| 1831 Immediate(kWordSize * SubtypeTestCache::kTestEntryLength)); |
| 1830 // Fall through to not found. | 1832 // Fall through to not found. |
| 1831 __ Bind(¬_found); | 1833 __ Bind(¬_found); |
| 1832 __ LoadImmediate(V0, reinterpret_cast<intptr_t>(Object::null())); | 1834 intptr_t null = reinterpret_cast<intptr_t>(Object::null()); |
| 1835 uint16_t null_lo = Utils::Low16Bits(null); |
| 1836 uint16_t null_hi = Utils::High16Bits(null); |
| 1837 __ lui(V0, Immediate(null_hi)); |
| 1833 __ Ret(); | 1838 __ Ret(); |
| 1839 __ delay_slot()->ori(V0, V0, Immediate(null_lo)); |
| 1834 | 1840 |
| 1835 __ Bind(&found); | 1841 __ Bind(&found); |
| 1836 __ Ret(); | 1842 __ Ret(); |
| 1837 __ delay_slot()->lw(V0, | 1843 __ delay_slot()->lw(V0, |
| 1838 Address(T2, kWordSize * SubtypeTestCache::kTestResult)); | 1844 Address(T2, kWordSize * SubtypeTestCache::kTestResult)); |
| 1839 } | 1845 } |
| 1840 | 1846 |
| 1841 | 1847 |
| 1842 // Used to check class and type arguments. Arguments passed in registers: | 1848 // Used to check class and type arguments. Arguments passed in registers: |
| 1843 // RA: return address. | 1849 // RA: return address. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1886 // A2: frame_pointer. | 1892 // A2: frame_pointer. |
| 1887 // A3: error object. | 1893 // A3: error object. |
| 1888 // SP: address of stacktrace object. | 1894 // SP: address of stacktrace object. |
| 1889 // Does not return. | 1895 // Does not return. |
| 1890 void StubCode::GenerateJumpToExceptionHandlerStub(Assembler* assembler) { | 1896 void StubCode::GenerateJumpToExceptionHandlerStub(Assembler* assembler) { |
| 1891 ASSERT(kExceptionObjectReg == V0); | 1897 ASSERT(kExceptionObjectReg == V0); |
| 1892 ASSERT(kStackTraceObjectReg == V1); | 1898 ASSERT(kStackTraceObjectReg == V1); |
| 1893 __ mov(V0, A3); // Exception object. | 1899 __ mov(V0, A3); // Exception object. |
| 1894 __ lw(V1, Address(SP, 0)); // StackTrace object. | 1900 __ lw(V1, Address(SP, 0)); // StackTrace object. |
| 1895 __ mov(FP, A2); // Frame_pointer. | 1901 __ mov(FP, A2); // Frame_pointer. |
| 1896 __ mov(SP, A1); // Stack pointer. | |
| 1897 __ jr(A0); // Jump to the exception handler code. | 1902 __ jr(A0); // Jump to the exception handler code. |
| 1903 __ delay_slot()->mov(SP, A1); // Stack pointer. |
| 1898 } | 1904 } |
| 1899 | 1905 |
| 1900 | 1906 |
| 1901 // Implements equality operator when one of the arguments is null | 1907 // Implements equality operator when one of the arguments is null |
| 1902 // (identity check) and updates ICData if necessary. | 1908 // (identity check) and updates ICData if necessary. |
| 1903 // RA: return address. | 1909 // RA: return address. |
| 1904 // A1: left argument. | 1910 // A1: left argument. |
| 1905 // A0: right argument. | 1911 // A0: right argument. |
| 1906 // T0: ICData. | 1912 // T0: ICData. |
| 1907 // V0: result. | 1913 // V0: result. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1932 __ lw(T3, Address(T6, 0 * kWordSize)); | 1938 __ lw(T3, Address(T6, 0 * kWordSize)); |
| 1933 __ bne(T2, T3, &no_match); // Class id match? | 1939 __ bne(T2, T3, &no_match); // Class id match? |
| 1934 | 1940 |
| 1935 // Check right. | 1941 // Check right. |
| 1936 __ bal(&get_class_id_as_smi); | 1942 __ bal(&get_class_id_as_smi); |
| 1937 __ delay_slot()->mov(T2, A0); | 1943 __ delay_slot()->mov(T2, A0); |
| 1938 __ lw(T3, Address(T6, 1 * kWordSize)); | 1944 __ lw(T3, Address(T6, 1 * kWordSize)); |
| 1939 __ beq(T2, T3, &found); // Class id match? | 1945 __ beq(T2, T3, &found); // Class id match? |
| 1940 __ Bind(&no_match); | 1946 __ Bind(&no_match); |
| 1941 // Next check group. | 1947 // Next check group. |
| 1942 __ AddImmediate(T6, kWordSize * ICData::TestEntryLengthFor(kNumArgsTested)); | 1948 intptr_t entry_bytes = kWordSize * ICData::TestEntryLengthFor(kNumArgsTested); |
| 1943 __ BranchNotEqual(T3, Smi::RawValue(kIllegalCid), &loop); // Done? | 1949 if (Utils::IsInt(kImmBits, entry_bytes)) { |
| 1950 __ BranchNotEqual(T3, Smi::RawValue(kIllegalCid), &loop); // Done? |
| 1951 __ delay_slot()->addiu(T6, T6, Immediate(entry_bytes)); |
| 1952 } else { |
| 1953 __ AddImmediate(T6, entry_bytes); |
| 1954 __ BranchNotEqual(T3, Smi::RawValue(kIllegalCid), &loop); // Done? |
| 1955 } |
| 1944 | 1956 |
| 1945 Label update_ic_data; | 1957 Label update_ic_data; |
| 1946 __ b(&update_ic_data); | 1958 __ b(&update_ic_data); |
| 1947 | 1959 |
| 1948 __ Bind(&found); | 1960 __ Bind(&found); |
| 1949 const intptr_t count_offset = | 1961 const intptr_t count_offset = |
| 1950 ICData::CountIndexFor(kNumArgsTested) * kWordSize; | 1962 ICData::CountIndexFor(kNumArgsTested) * kWordSize; |
| 1951 Label no_overflow; | 1963 Label no_overflow; |
| 1952 __ lw(T1, Address(T6, count_offset)); | 1964 __ lw(T1, Address(T6, count_offset)); |
| 1953 __ AddImmediateDetectOverflow(T1, T1, Smi::RawValue(1), CMPRES); | 1965 __ AddImmediateDetectOverflow(T1, T1, Smi::RawValue(1), CMPRES); |
| 1954 __ bgez(CMPRES, &no_overflow); | 1966 __ bgez(CMPRES, &no_overflow); |
| 1955 __ LoadImmediate(TMP1, Smi::RawValue(Smi::kMaxValue)); | 1967 __ LoadImmediate(TMP1, Smi::RawValue(Smi::kMaxValue)); |
| 1956 __ sw(TMP1, Address(T6, count_offset)); // If overflow. | 1968 __ sw(TMP1, Address(T6, count_offset)); // If overflow. |
| 1957 __ Bind(&no_overflow); | 1969 __ Bind(&no_overflow); |
| 1958 | 1970 |
| 1959 Label compute_result; | 1971 Label compute_result; |
| 1960 __ Bind(&compute_result); | 1972 __ Bind(&compute_result); |
| 1961 __ LoadObject(TMP1, Bool::True()); | 1973 __ LoadObject(TMP1, Bool::True()); |
| 1962 __ LoadObject(TMP2, Bool::False()); | 1974 __ LoadObject(TMP2, Bool::False()); |
| 1963 __ subu(CMPRES, A0, A1); | 1975 __ subu(CMPRES, A0, A1); |
| 1964 __ movz(V0, TMP1, CMPRES); | 1976 __ movz(V0, TMP1, CMPRES); |
| 1965 __ movn(V0, TMP2, CMPRES); | 1977 __ movn(V0, TMP2, CMPRES); |
| 1966 __ LeaveStubFrame(); | 1978 __ LeaveStubFrameAndReturn(); |
| 1967 __ Ret(); | |
| 1968 | 1979 |
| 1969 __ Bind(&get_class_id_as_smi); | 1980 __ Bind(&get_class_id_as_smi); |
| 1970 // Test if Smi -> load Smi class for comparison. | 1981 // Test if Smi -> load Smi class for comparison. |
| 1971 Label not_smi; | 1982 Label not_smi; |
| 1972 __ andi(CMPRES, T2, Immediate(kSmiTagMask)); | 1983 __ andi(CMPRES, T2, Immediate(kSmiTagMask)); |
| 1973 __ bne(CMPRES, ZR, ¬_smi); | 1984 __ bne(CMPRES, ZR, ¬_smi); |
| 1974 __ jr(RA); | 1985 __ jr(RA); |
| 1975 __ delay_slot()->addiu(T2, ZR, Immediate(Smi::RawValue(kSmiCid))); | 1986 __ delay_slot()->addiu(T2, ZR, Immediate(Smi::RawValue(kSmiCid))); |
| 1976 __ Bind(¬_smi); | 1987 __ Bind(¬_smi); |
| 1977 __ LoadClassId(T2, T2); | 1988 __ LoadClassId(T2, T2); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 2007 __ sw(TMP1, Address(SP, 1 * kWordSize)); | 2018 __ sw(TMP1, Address(SP, 1 * kWordSize)); |
| 2008 __ sw(T0, Address(SP, 0 * kWordSize)); | 2019 __ sw(T0, Address(SP, 0 * kWordSize)); |
| 2009 __ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry); | 2020 __ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry); |
| 2010 __ TraceSimMsg("OptimizeFunctionStub return"); | 2021 __ TraceSimMsg("OptimizeFunctionStub return"); |
| 2011 __ lw(T0, Address(SP, 1 * kWordSize)); // Get Code object | 2022 __ lw(T0, Address(SP, 1 * kWordSize)); // Get Code object |
| 2012 __ lw(S4, Address(SP, 2 * kWordSize)); // Restore argument descriptor. | 2023 __ lw(S4, Address(SP, 2 * kWordSize)); // Restore argument descriptor. |
| 2013 __ addiu(SP, SP, Immediate(3 * kWordSize)); // Discard argument. | 2024 __ addiu(SP, SP, Immediate(3 * kWordSize)); // Discard argument. |
| 2014 | 2025 |
| 2015 __ lw(T0, FieldAddress(T0, Code::instructions_offset())); | 2026 __ lw(T0, FieldAddress(T0, Code::instructions_offset())); |
| 2016 __ AddImmediate(T0, Instructions::HeaderSize() - kHeapObjectTag); | 2027 __ AddImmediate(T0, Instructions::HeaderSize() - kHeapObjectTag); |
| 2017 __ LeaveStubFrame(); | 2028 __ LeaveStubFrameAndReturn(T0); |
| 2018 __ jr(T0); | |
| 2019 __ break_(0); | 2029 __ break_(0); |
| 2020 } | 2030 } |
| 2021 | 2031 |
| 2022 | 2032 |
| 2023 DECLARE_LEAF_RUNTIME_ENTRY(intptr_t, | 2033 DECLARE_LEAF_RUNTIME_ENTRY(intptr_t, |
| 2024 BigintCompare, | 2034 BigintCompare, |
| 2025 RawBigint* left, | 2035 RawBigint* left, |
| 2026 RawBigint* right); | 2036 RawBigint* right); |
| 2027 | 2037 |
| 2028 | 2038 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2117 __ Bind(&done); | 2127 __ Bind(&done); |
| 2118 __ lw(T0, Address(SP, 0 * kWordSize)); | 2128 __ lw(T0, Address(SP, 0 * kWordSize)); |
| 2119 __ lw(T1, Address(SP, 1 * kWordSize)); | 2129 __ lw(T1, Address(SP, 1 * kWordSize)); |
| 2120 __ Ret(); | 2130 __ Ret(); |
| 2121 __ delay_slot()->addiu(SP, SP, Immediate(2 * kWordSize)); | 2131 __ delay_slot()->addiu(SP, SP, Immediate(2 * kWordSize)); |
| 2122 } | 2132 } |
| 2123 | 2133 |
| 2124 } // namespace dart | 2134 } // namespace dart |
| 2125 | 2135 |
| 2126 #endif // defined TARGET_ARCH_MIPS | 2136 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |