| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 | 410 |
| 411 | 411 |
| 412 static MemOperand GenerateMappedArgumentsLookup(MacroAssembler* masm, | 412 static MemOperand GenerateMappedArgumentsLookup(MacroAssembler* masm, |
| 413 Register object, | 413 Register object, |
| 414 Register key, | 414 Register key, |
| 415 Register scratch1, | 415 Register scratch1, |
| 416 Register scratch2, | 416 Register scratch2, |
| 417 Register scratch3, | 417 Register scratch3, |
| 418 Label* unmapped_case, | 418 Label* unmapped_case, |
| 419 Label* slow_case) { | 419 Label* slow_case) { |
| 420 Heap* heap = masm->isolate()->heap(); |
| 421 |
| 420 // Check that the receiver is a JSObject. Because of the map check | 422 // Check that the receiver is a JSObject. Because of the map check |
| 421 // later, we do not need to check for interceptors or whether it | 423 // later, we do not need to check for interceptors or whether it |
| 422 // requires access checks. | 424 // requires access checks. |
| 423 __ JumpIfSmi(object, slow_case); | 425 __ JumpIfSmi(object, slow_case); |
| 424 // Check that the object is some kind of JSObject. | 426 // Check that the object is some kind of JSObject. |
| 425 __ GetObjectType(object, scratch1, scratch2); | 427 __ GetObjectType(object, scratch1, scratch2); |
| 426 __ Branch(slow_case, lt, scratch2, Operand(FIRST_JS_RECEIVER_TYPE)); | 428 __ Branch(slow_case, lt, scratch2, Operand(FIRST_JS_RECEIVER_TYPE)); |
| 427 | 429 |
| 428 // Check that the key is a positive smi. | 430 // Check that the key is a positive smi. |
| 429 __ And(scratch1, key, Operand(0x80000001)); | 431 __ And(scratch1, key, Operand(0x80000001)); |
| 430 __ Branch(slow_case, ne, scratch1, Operand(zero_reg)); | 432 __ Branch(slow_case, ne, scratch1, Operand(zero_reg)); |
| 431 | 433 |
| 432 // Load the elements into scratch1 and check its map. | 434 // Load the elements into scratch1 and check its map. |
| 435 Handle<Map> arguments_map(heap->sloppy_arguments_elements_map()); |
| 433 __ lw(scratch1, FieldMemOperand(object, JSObject::kElementsOffset)); | 436 __ lw(scratch1, FieldMemOperand(object, JSObject::kElementsOffset)); |
| 434 __ CheckMap(scratch1, | 437 __ CheckMap(scratch1, |
| 435 scratch2, | 438 scratch2, |
| 436 Heap::kNonStrictArgumentsElementsMapRootIndex, | 439 arguments_map, |
| 437 slow_case, | 440 slow_case, |
| 438 DONT_DO_SMI_CHECK); | 441 DONT_DO_SMI_CHECK); |
| 439 // Check if element is in the range of mapped arguments. If not, jump | 442 // Check if element is in the range of mapped arguments. If not, jump |
| 440 // to the unmapped lookup with the parameter map in scratch1. | 443 // to the unmapped lookup with the parameter map in scratch1. |
| 441 __ lw(scratch2, FieldMemOperand(scratch1, FixedArray::kLengthOffset)); | 444 __ lw(scratch2, FieldMemOperand(scratch1, FixedArray::kLengthOffset)); |
| 442 __ Subu(scratch2, scratch2, Operand(Smi::FromInt(2))); | 445 __ Subu(scratch2, scratch2, Operand(Smi::FromInt(2))); |
| 443 __ Branch(unmapped_case, Ugreater_equal, key, Operand(scratch2)); | 446 __ Branch(unmapped_case, Ugreater_equal, key, Operand(scratch2)); |
| 444 | 447 |
| 445 // Load element index and check whether it is the hole. | 448 // Load element index and check whether it is the hole. |
| 446 const int kOffset = | 449 const int kOffset = |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 __ li(scratch, Operand(kPointerSize >> 1)); | 492 __ li(scratch, Operand(kPointerSize >> 1)); |
| 490 __ Mul(scratch, key, scratch); | 493 __ Mul(scratch, key, scratch); |
| 491 __ Addu(scratch, | 494 __ Addu(scratch, |
| 492 scratch, | 495 scratch, |
| 493 Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | 496 Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
| 494 __ Addu(scratch, backing_store, scratch); | 497 __ Addu(scratch, backing_store, scratch); |
| 495 return MemOperand(scratch); | 498 return MemOperand(scratch); |
| 496 } | 499 } |
| 497 | 500 |
| 498 | 501 |
| 499 void KeyedLoadIC::GenerateNonStrictArguments(MacroAssembler* masm) { | 502 void KeyedLoadIC::GenerateSloppyArguments(MacroAssembler* masm) { |
| 500 // ---------- S t a t e -------------- | 503 // ---------- S t a t e -------------- |
| 501 // -- lr : return address | 504 // -- lr : return address |
| 502 // -- a0 : key | 505 // -- a0 : key |
| 503 // -- a1 : receiver | 506 // -- a1 : receiver |
| 504 // ----------------------------------- | 507 // ----------------------------------- |
| 505 Label slow, notin; | 508 Label slow, notin; |
| 506 MemOperand mapped_location = | 509 MemOperand mapped_location = |
| 507 GenerateMappedArgumentsLookup(masm, a1, a0, a2, a3, t0, ¬in, &slow); | 510 GenerateMappedArgumentsLookup(masm, a1, a0, a2, a3, t0, ¬in, &slow); |
| 508 __ Ret(USE_DELAY_SLOT); | 511 __ Ret(USE_DELAY_SLOT); |
| 509 __ lw(v0, mapped_location); | 512 __ lw(v0, mapped_location); |
| 510 __ bind(¬in); | 513 __ bind(¬in); |
| 511 // The unmapped lookup expects that the parameter map is in a2. | 514 // The unmapped lookup expects that the parameter map is in a2. |
| 512 MemOperand unmapped_location = | 515 MemOperand unmapped_location = |
| 513 GenerateUnmappedArgumentsLookup(masm, a0, a2, a3, &slow); | 516 GenerateUnmappedArgumentsLookup(masm, a0, a2, a3, &slow); |
| 514 __ lw(a2, unmapped_location); | 517 __ lw(a2, unmapped_location); |
| 515 __ LoadRoot(a3, Heap::kTheHoleValueRootIndex); | 518 __ LoadRoot(a3, Heap::kTheHoleValueRootIndex); |
| 516 __ Branch(&slow, eq, a2, Operand(a3)); | 519 __ Branch(&slow, eq, a2, Operand(a3)); |
| 517 __ Ret(USE_DELAY_SLOT); | 520 __ Ret(USE_DELAY_SLOT); |
| 518 __ mov(v0, a2); | 521 __ mov(v0, a2); |
| 519 __ bind(&slow); | 522 __ bind(&slow); |
| 520 GenerateMiss(masm); | 523 GenerateMiss(masm); |
| 521 } | 524 } |
| 522 | 525 |
| 523 | 526 |
| 524 void KeyedStoreIC::GenerateNonStrictArguments(MacroAssembler* masm) { | 527 void KeyedStoreIC::GenerateSloppyArguments(MacroAssembler* masm) { |
| 525 // ---------- S t a t e -------------- | 528 // ---------- S t a t e -------------- |
| 526 // -- a0 : value | 529 // -- a0 : value |
| 527 // -- a1 : key | 530 // -- a1 : key |
| 528 // -- a2 : receiver | 531 // -- a2 : receiver |
| 529 // -- lr : return address | 532 // -- lr : return address |
| 530 // ----------------------------------- | 533 // ----------------------------------- |
| 531 Label slow, notin; | 534 Label slow, notin; |
| 532 // Store address is returned in register (of MemOperand) mapped_location. | 535 // Store address is returned in register (of MemOperand) mapped_location. |
| 533 MemOperand mapped_location = | 536 MemOperand mapped_location = |
| 534 GenerateMappedArgumentsLookup(masm, a2, a1, a3, t0, t1, ¬in, &slow); | 537 GenerateMappedArgumentsLookup(masm, a2, a1, a3, t0, t1, ¬in, &slow); |
| (...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1347 } else { | 1350 } else { |
| 1348 ASSERT(Assembler::IsBne(branch_instr)); | 1351 ASSERT(Assembler::IsBne(branch_instr)); |
| 1349 patcher.ChangeBranchCondition(eq); | 1352 patcher.ChangeBranchCondition(eq); |
| 1350 } | 1353 } |
| 1351 } | 1354 } |
| 1352 | 1355 |
| 1353 | 1356 |
| 1354 } } // namespace v8::internal | 1357 } } // namespace v8::internal |
| 1355 | 1358 |
| 1356 #endif // V8_TARGET_ARCH_MIPS | 1359 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |