| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 // Scratch registers: | 73 // Scratch registers: |
| 74 // scratch0: used to holds the receiver map. | 74 // scratch0: used to holds the receiver map. |
| 75 // scratch1: used to holds the receiver instance type, receiver bit mask | 75 // scratch1: used to holds the receiver instance type, receiver bit mask |
| 76 // and elements map. | 76 // and elements map. |
| 77 | 77 |
| 78 // Check that the receiver isn't a smi. | 78 // Check that the receiver isn't a smi. |
| 79 __ JumpIfSmi(receiver, miss); | 79 __ JumpIfSmi(receiver, miss); |
| 80 | 80 |
| 81 // Check that the receiver is a valid JS object. | 81 // Check that the receiver is a valid JS object. |
| 82 __ GetObjectType(receiver, scratch0, scratch1); | 82 __ GetObjectType(receiver, scratch0, scratch1); |
| 83 __ Branch(miss, lt, scratch1, Operand(FIRST_JS_OBJECT_TYPE)); | 83 __ Branch(miss, lt, scratch1, Operand(FIRST_SPEC_OBJECT_TYPE)); |
| 84 | 84 |
| 85 // If this assert fails, we have to check upper bound too. | 85 // If this assert fails, we have to check upper bound too. |
| 86 ASSERT(LAST_TYPE == JS_FUNCTION_TYPE); | 86 STATIC_ASSERT(LAST_TYPE == LAST_SPEC_OBJECT_TYPE); |
| 87 | 87 |
| 88 GenerateGlobalInstanceTypeCheck(masm, scratch1, miss); | 88 GenerateGlobalInstanceTypeCheck(masm, scratch1, miss); |
| 89 | 89 |
| 90 // Check that the global object does not require access checks. | 90 // Check that the global object does not require access checks. |
| 91 __ lbu(scratch1, FieldMemOperand(scratch0, Map::kBitFieldOffset)); | 91 __ lbu(scratch1, FieldMemOperand(scratch0, Map::kBitFieldOffset)); |
| 92 __ And(scratch1, scratch1, Operand((1 << Map::kIsAccessCheckNeeded) | | 92 __ And(scratch1, scratch1, Operand((1 << Map::kIsAccessCheckNeeded) | |
| 93 (1 << Map::kHasNamedInterceptor))); | 93 (1 << Map::kHasNamedInterceptor))); |
| 94 __ Branch(miss, ne, scratch1, Operand(zero_reg)); | 94 __ Branch(miss, ne, scratch1, Operand(zero_reg)); |
| 95 | 95 |
| 96 __ lw(elements, FieldMemOperand(receiver, JSObject::kPropertiesOffset)); | 96 __ lw(elements, FieldMemOperand(receiver, JSObject::kPropertiesOffset)); |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 | 560 |
| 561 // Check that the value isn't a smi. | 561 // Check that the value isn't a smi. |
| 562 __ JumpIfSmi(a1, miss); | 562 __ JumpIfSmi(a1, miss); |
| 563 | 563 |
| 564 // Check that the value is a JSFunction. | 564 // Check that the value is a JSFunction. |
| 565 __ GetObjectType(a1, scratch, scratch); | 565 __ GetObjectType(a1, scratch, scratch); |
| 566 __ Branch(miss, ne, scratch, Operand(JS_FUNCTION_TYPE)); | 566 __ Branch(miss, ne, scratch, Operand(JS_FUNCTION_TYPE)); |
| 567 | 567 |
| 568 // Invoke the function. | 568 // Invoke the function. |
| 569 ParameterCount actual(argc); | 569 ParameterCount actual(argc); |
| 570 __ InvokeFunction(a1, actual, JUMP_FUNCTION); | 570 __ InvokeFunction(a1, actual, JUMP_FUNCTION, |
| 571 NullCallWrapper(), CALL_AS_METHOD); |
| 571 } | 572 } |
| 572 | 573 |
| 573 | 574 |
| 574 static void GenerateCallNormal(MacroAssembler* masm, int argc) { | 575 static void GenerateCallNormal(MacroAssembler* masm, int argc) { |
| 575 // ----------- S t a t e ------------- | 576 // ----------- S t a t e ------------- |
| 576 // -- a2 : name | 577 // -- a2 : name |
| 577 // -- ra : return address | 578 // -- ra : return address |
| 578 // ----------------------------------- | 579 // ----------------------------------- |
| 579 Label miss; | 580 Label miss; |
| 580 | 581 |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 942 | 943 |
| 943 // Check that the key is a smi. | 944 // Check that the key is a smi. |
| 944 __ JumpIfNotSmi(key, &check_string); | 945 __ JumpIfNotSmi(key, &check_string); |
| 945 __ bind(&index_smi); | 946 __ bind(&index_smi); |
| 946 // Now the key is known to be a smi. This place is also jumped to from below | 947 // Now the key is known to be a smi. This place is also jumped to from below |
| 947 // where a numeric string is converted to a smi. | 948 // where a numeric string is converted to a smi. |
| 948 | 949 |
| 949 GenerateKeyedLoadReceiverCheck( | 950 GenerateKeyedLoadReceiverCheck( |
| 950 masm, receiver, a2, a3, Map::kHasIndexedInterceptor, &slow); | 951 masm, receiver, a2, a3, Map::kHasIndexedInterceptor, &slow); |
| 951 | 952 |
| 952 // Check the "has fast elements" bit in the receiver's map which is | 953 // Check the receiver's map to see if it has fast elements. |
| 953 // now in a2. | 954 __ CheckFastElements(a2, a3, &check_number_dictionary); |
| 954 __ lbu(a3, FieldMemOperand(a2, Map::kBitField2Offset)); | |
| 955 __ And(at, a3, Operand(1 << Map::kHasFastElements)); | |
| 956 __ Branch(&check_number_dictionary, eq, at, Operand(zero_reg)); | |
| 957 | 955 |
| 958 GenerateFastArrayLoad( | 956 GenerateFastArrayLoad( |
| 959 masm, receiver, key, t0, a3, a2, v0, NULL, &slow); | 957 masm, receiver, key, t0, a3, a2, v0, NULL, &slow); |
| 960 | 958 |
| 961 __ IncrementCounter(isolate->counters()->keyed_load_generic_smi(), 1, a2, a3); | 959 __ IncrementCounter(isolate->counters()->keyed_load_generic_smi(), 1, a2, a3); |
| 962 __ Ret(); | 960 __ Ret(); |
| 963 | 961 |
| 964 __ bind(&check_number_dictionary); | 962 __ bind(&check_number_dictionary); |
| 965 __ lw(t0, FieldMemOperand(receiver, JSObject::kElementsOffset)); | 963 __ lw(t0, FieldMemOperand(receiver, JSObject::kElementsOffset)); |
| 966 __ lw(a3, FieldMemOperand(t0, JSObject::kMapOffset)); | 964 __ lw(a3, FieldMemOperand(t0, JSObject::kMapOffset)); |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1166 __ lw(t3, FieldMemOperand(receiver, HeapObject::kMapOffset)); | 1164 __ lw(t3, FieldMemOperand(receiver, HeapObject::kMapOffset)); |
| 1167 // Check that the receiver does not require access checks. We need | 1165 // Check that the receiver does not require access checks. We need |
| 1168 // to do this because this generic stub does not perform map checks. | 1166 // to do this because this generic stub does not perform map checks. |
| 1169 __ lbu(t0, FieldMemOperand(t3, Map::kBitFieldOffset)); | 1167 __ lbu(t0, FieldMemOperand(t3, Map::kBitFieldOffset)); |
| 1170 __ And(t0, t0, Operand(1 << Map::kIsAccessCheckNeeded)); | 1168 __ And(t0, t0, Operand(1 << Map::kIsAccessCheckNeeded)); |
| 1171 __ Branch(&slow, ne, t0, Operand(zero_reg)); | 1169 __ Branch(&slow, ne, t0, Operand(zero_reg)); |
| 1172 // Check if the object is a JS array or not. | 1170 // Check if the object is a JS array or not. |
| 1173 __ lbu(t3, FieldMemOperand(t3, Map::kInstanceTypeOffset)); | 1171 __ lbu(t3, FieldMemOperand(t3, Map::kInstanceTypeOffset)); |
| 1174 | 1172 |
| 1175 __ Branch(&array, eq, t3, Operand(JS_ARRAY_TYPE)); | 1173 __ Branch(&array, eq, t3, Operand(JS_ARRAY_TYPE)); |
| 1176 // Check that the object is some kind of JS object. | 1174 // Check that the object is some kind of JSObject. |
| 1177 __ Branch(&slow, lt, t3, Operand(FIRST_JS_OBJECT_TYPE)); | 1175 __ Branch(&slow, lt, t3, Operand(FIRST_JS_RECEIVER_TYPE)); |
| 1176 __ Branch(&slow, eq, t3, Operand(JS_PROXY_TYPE)); |
| 1177 __ Branch(&slow, eq, t3, Operand(JS_FUNCTION_PROXY_TYPE)); |
| 1178 | 1178 |
| 1179 // Object case: Check key against length in the elements array. | 1179 // Object case: Check key against length in the elements array. |
| 1180 __ lw(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); | 1180 __ lw(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); |
| 1181 // Check that the object is in fast mode and writable. | 1181 // Check that the object is in fast mode and writable. |
| 1182 __ lw(t3, FieldMemOperand(elements, HeapObject::kMapOffset)); | 1182 __ lw(t3, FieldMemOperand(elements, HeapObject::kMapOffset)); |
| 1183 __ LoadRoot(t0, Heap::kFixedArrayMapRootIndex); | 1183 __ LoadRoot(t0, Heap::kFixedArrayMapRootIndex); |
| 1184 __ Branch(&slow, ne, t3, Operand(t0)); | 1184 __ Branch(&slow, ne, t3, Operand(t0)); |
| 1185 // Check array bounds. Both the key and the length of FixedArray are smis. | 1185 // Check array bounds. Both the key and the length of FixedArray are smis. |
| 1186 __ lw(t0, FieldMemOperand(elements, FixedArray::kLengthOffset)); | 1186 __ lw(t0, FieldMemOperand(elements, FixedArray::kLengthOffset)); |
| 1187 __ Branch(&fast, lo, key, Operand(t0)); | 1187 __ Branch(&fast, lo, key, Operand(t0)); |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1571 Register reg = Register::from_code(Assembler::GetRs(instr_at_patch)); | 1571 Register reg = Register::from_code(Assembler::GetRs(instr_at_patch)); |
| 1572 patcher.masm()->andi(at, reg, kSmiTagMask); | 1572 patcher.masm()->andi(at, reg, kSmiTagMask); |
| 1573 patcher.ChangeBranchCondition(eq); | 1573 patcher.ChangeBranchCondition(eq); |
| 1574 } | 1574 } |
| 1575 } | 1575 } |
| 1576 | 1576 |
| 1577 | 1577 |
| 1578 } } // namespace v8::internal | 1578 } } // namespace v8::internal |
| 1579 | 1579 |
| 1580 #endif // V8_TARGET_ARCH_MIPS | 1580 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |