| 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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 793 | 796 |
| 794 StubRuntimeCallHelper call_helper; | 797 StubRuntimeCallHelper call_helper; |
| 795 char_at_generator.GenerateSlow(masm, call_helper); | 798 char_at_generator.GenerateSlow(masm, call_helper); |
| 796 | 799 |
| 797 __ bind(&miss); | 800 __ bind(&miss); |
| 798 GenerateMiss(masm); | 801 GenerateMiss(masm); |
| 799 } | 802 } |
| 800 | 803 |
| 801 | 804 |
| 802 void KeyedStoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm, | 805 void KeyedStoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm, |
| 803 StrictModeFlag strict_mode) { | 806 StrictMode strict_mode) { |
| 804 // ---------- S t a t e -------------- | 807 // ---------- S t a t e -------------- |
| 805 // -- a0 : value | 808 // -- a0 : value |
| 806 // -- a1 : key | 809 // -- a1 : key |
| 807 // -- a2 : receiver | 810 // -- a2 : receiver |
| 808 // -- ra : return address | 811 // -- ra : return address |
| 809 // ----------------------------------- | 812 // ----------------------------------- |
| 810 | 813 |
| 811 // Push receiver, key and value for runtime call. | 814 // Push receiver, key and value for runtime call. |
| 812 __ Push(a2, a1, a0); | 815 __ Push(a2, a1, a0); |
| 813 __ li(a1, Operand(Smi::FromInt(NONE))); // PropertyAttributes. | 816 __ li(a1, Operand(Smi::FromInt(NONE))); // PropertyAttributes. |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 985 slow); | 988 slow); |
| 986 ASSERT(receiver_map.is(a3)); // Transition code expects map in a3 | 989 ASSERT(receiver_map.is(a3)); // Transition code expects map in a3 |
| 987 mode = AllocationSite::GetMode(FAST_DOUBLE_ELEMENTS, FAST_ELEMENTS); | 990 mode = AllocationSite::GetMode(FAST_DOUBLE_ELEMENTS, FAST_ELEMENTS); |
| 988 ElementsTransitionGenerator::GenerateDoubleToObject(masm, mode, slow); | 991 ElementsTransitionGenerator::GenerateDoubleToObject(masm, mode, slow); |
| 989 __ lw(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); | 992 __ lw(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); |
| 990 __ jmp(&finish_object_store); | 993 __ jmp(&finish_object_store); |
| 991 } | 994 } |
| 992 | 995 |
| 993 | 996 |
| 994 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm, | 997 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm, |
| 995 StrictModeFlag strict_mode) { | 998 StrictMode strict_mode) { |
| 996 // ---------- S t a t e -------------- | 999 // ---------- S t a t e -------------- |
| 997 // -- a0 : value | 1000 // -- a0 : value |
| 998 // -- a1 : key | 1001 // -- a1 : key |
| 999 // -- a2 : receiver | 1002 // -- a2 : receiver |
| 1000 // -- ra : return address | 1003 // -- ra : return address |
| 1001 // ----------------------------------- | 1004 // ----------------------------------- |
| 1002 Label slow, fast_object, fast_object_grow; | 1005 Label slow, fast_object, fast_object_grow; |
| 1003 Label fast_double, fast_double_grow; | 1006 Label fast_double, fast_double_grow; |
| 1004 Label array, extra, check_if_double_array; | 1007 Label array, extra, check_if_double_array; |
| 1005 | 1008 |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1228 __ IncrementCounter(counters->store_normal_hit(), 1, t0, t1); | 1231 __ IncrementCounter(counters->store_normal_hit(), 1, t0, t1); |
| 1229 __ Ret(); | 1232 __ Ret(); |
| 1230 | 1233 |
| 1231 __ bind(&miss); | 1234 __ bind(&miss); |
| 1232 __ IncrementCounter(counters->store_normal_miss(), 1, t0, t1); | 1235 __ IncrementCounter(counters->store_normal_miss(), 1, t0, t1); |
| 1233 GenerateMiss(masm); | 1236 GenerateMiss(masm); |
| 1234 } | 1237 } |
| 1235 | 1238 |
| 1236 | 1239 |
| 1237 void StoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm, | 1240 void StoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm, |
| 1238 StrictModeFlag strict_mode) { | 1241 StrictMode strict_mode) { |
| 1239 // ----------- S t a t e ------------- | 1242 // ----------- S t a t e ------------- |
| 1240 // -- a0 : value | 1243 // -- a0 : value |
| 1241 // -- a1 : receiver | 1244 // -- a1 : receiver |
| 1242 // -- a2 : name | 1245 // -- a2 : name |
| 1243 // -- ra : return address | 1246 // -- ra : return address |
| 1244 // ----------------------------------- | 1247 // ----------------------------------- |
| 1245 | 1248 |
| 1246 __ Push(a1, a2, a0); | 1249 __ Push(a1, a2, a0); |
| 1247 | 1250 |
| 1248 __ li(a1, Operand(Smi::FromInt(NONE))); // PropertyAttributes. | 1251 __ li(a1, Operand(Smi::FromInt(NONE))); // PropertyAttributes. |
| (...skipping 98 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 |