OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
781 // necessary. | 781 // necessary. |
782 if (object->IsGlobalObject()) { | 782 if (object->IsGlobalObject()) { |
783 __ ldr(r3, FieldMemOperand(r0, GlobalObject::kGlobalReceiverOffset)); | 783 __ ldr(r3, FieldMemOperand(r0, GlobalObject::kGlobalReceiverOffset)); |
784 __ str(r3, MemOperand(sp, argc * kPointerSize)); | 784 __ str(r3, MemOperand(sp, argc * kPointerSize)); |
785 } | 785 } |
786 | 786 |
787 // Setup the context (function already in r1). | 787 // Setup the context (function already in r1). |
788 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); | 788 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); |
789 | 789 |
790 // Jump to the cached code (tail call). | 790 // Jump to the cached code (tail call). |
791 __ IncrementCounter(&Counters::call_global_inline, 1, r2, r3); | 791 __ IncrementCounter(&COUNTER(call_global_inline), 1, r2, r3); |
792 ASSERT(function->is_compiled()); | 792 ASSERT(function->is_compiled()); |
793 Handle<Code> code(function->code()); | 793 Handle<Code> code(function->code()); |
794 ParameterCount expected(function->shared()->formal_parameter_count()); | 794 ParameterCount expected(function->shared()->formal_parameter_count()); |
795 __ InvokeCode(code, expected, arguments(), | 795 __ InvokeCode(code, expected, arguments(), |
796 RelocInfo::CODE_TARGET, JUMP_FUNCTION); | 796 RelocInfo::CODE_TARGET, JUMP_FUNCTION); |
797 | 797 |
798 // Handle call cache miss. | 798 // Handle call cache miss. |
799 __ bind(&miss); | 799 __ bind(&miss); |
800 __ IncrementCounter(&Counters::call_global_inline_miss, 1, r1, r3); | 800 __ IncrementCounter(&COUNTER(call_global_inline_miss), 1, r1, r3); |
801 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); | 801 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); |
802 __ Jump(ic, RelocInfo::CODE_TARGET); | 802 __ Jump(ic, RelocInfo::CODE_TARGET); |
803 | 803 |
804 // Return the generated code. | 804 // Return the generated code. |
805 return GetCode(NORMAL, name); | 805 return GetCode(NORMAL, name); |
806 } | 806 } |
807 | 807 |
808 | 808 |
809 Object* StoreStubCompiler::CompileStoreField(JSObject* object, | 809 Object* StoreStubCompiler::CompileStoreField(JSObject* object, |
810 int index, | 810 int index, |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
960 // Check that the map of the global has not changed. | 960 // Check that the map of the global has not changed. |
961 __ ldr(r1, MemOperand(sp, 0 * kPointerSize)); | 961 __ ldr(r1, MemOperand(sp, 0 * kPointerSize)); |
962 __ ldr(r3, FieldMemOperand(r1, HeapObject::kMapOffset)); | 962 __ ldr(r3, FieldMemOperand(r1, HeapObject::kMapOffset)); |
963 __ cmp(r3, Operand(Handle<Map>(object->map()))); | 963 __ cmp(r3, Operand(Handle<Map>(object->map()))); |
964 __ b(ne, &miss); | 964 __ b(ne, &miss); |
965 | 965 |
966 // Store the value in the cell. | 966 // Store the value in the cell. |
967 __ mov(r2, Operand(Handle<JSGlobalPropertyCell>(cell))); | 967 __ mov(r2, Operand(Handle<JSGlobalPropertyCell>(cell))); |
968 __ str(r0, FieldMemOperand(r2, JSGlobalPropertyCell::kValueOffset)); | 968 __ str(r0, FieldMemOperand(r2, JSGlobalPropertyCell::kValueOffset)); |
969 | 969 |
970 __ IncrementCounter(&Counters::named_store_global_inline, 1, r1, r3); | 970 __ IncrementCounter(&COUNTER(named_store_global_inline), 1, r1, r3); |
971 __ Ret(); | 971 __ Ret(); |
972 | 972 |
973 // Handle store cache miss. | 973 // Handle store cache miss. |
974 __ bind(&miss); | 974 __ bind(&miss); |
975 __ IncrementCounter(&Counters::named_store_global_inline_miss, 1, r1, r3); | 975 __ IncrementCounter(&COUNTER(named_store_global_inline_miss), 1, r1, r3); |
976 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); | 976 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); |
977 __ Jump(ic, RelocInfo::CODE_TARGET); | 977 __ Jump(ic, RelocInfo::CODE_TARGET); |
978 | 978 |
979 // Return the generated code. | 979 // Return the generated code. |
980 return GetCode(NORMAL, name); | 980 return GetCode(NORMAL, name); |
981 } | 981 } |
982 | 982 |
983 | 983 |
984 Object* LoadStubCompiler::CompileLoadField(JSObject* object, | 984 Object* LoadStubCompiler::CompileLoadField(JSObject* object, |
985 JSObject* holder, | 985 JSObject* holder, |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1107 __ mov(r3, Operand(Handle<JSGlobalPropertyCell>(cell))); | 1107 __ mov(r3, Operand(Handle<JSGlobalPropertyCell>(cell))); |
1108 __ ldr(r0, FieldMemOperand(r3, JSGlobalPropertyCell::kValueOffset)); | 1108 __ ldr(r0, FieldMemOperand(r3, JSGlobalPropertyCell::kValueOffset)); |
1109 | 1109 |
1110 // Check for deleted property if property can actually be deleted. | 1110 // Check for deleted property if property can actually be deleted. |
1111 if (!is_dont_delete) { | 1111 if (!is_dont_delete) { |
1112 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); | 1112 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); |
1113 __ cmp(r0, ip); | 1113 __ cmp(r0, ip); |
1114 __ b(eq, &miss); | 1114 __ b(eq, &miss); |
1115 } | 1115 } |
1116 | 1116 |
1117 __ IncrementCounter(&Counters::named_load_global_inline, 1, r1, r3); | 1117 __ IncrementCounter(&COUNTER(named_load_global_inline), 1, r1, r3); |
1118 __ Ret(); | 1118 __ Ret(); |
1119 | 1119 |
1120 __ bind(&miss); | 1120 __ bind(&miss); |
1121 __ IncrementCounter(&Counters::named_load_global_inline_miss, 1, r1, r3); | 1121 __ IncrementCounter(&COUNTER(named_load_global_inline_miss), 1, r1, r3); |
1122 GenerateLoadMiss(masm(), Code::LOAD_IC); | 1122 GenerateLoadMiss(masm(), Code::LOAD_IC); |
1123 | 1123 |
1124 // Return the generated code. | 1124 // Return the generated code. |
1125 return GetCode(NORMAL, name); | 1125 return GetCode(NORMAL, name); |
1126 } | 1126 } |
1127 | 1127 |
1128 | 1128 |
1129 Object* KeyedLoadStubCompiler::CompileLoadField(String* name, | 1129 Object* KeyedLoadStubCompiler::CompileLoadField(String* name, |
1130 JSObject* receiver, | 1130 JSObject* receiver, |
1131 JSObject* holder, | 1131 JSObject* holder, |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1261 } | 1261 } |
1262 | 1262 |
1263 | 1263 |
1264 Object* KeyedLoadStubCompiler::CompileLoadStringLength(String* name) { | 1264 Object* KeyedLoadStubCompiler::CompileLoadStringLength(String* name) { |
1265 // ----------- S t a t e ------------- | 1265 // ----------- S t a t e ------------- |
1266 // -- lr : return address | 1266 // -- lr : return address |
1267 // -- sp[0] : key | 1267 // -- sp[0] : key |
1268 // -- sp[4] : receiver | 1268 // -- sp[4] : receiver |
1269 // ----------------------------------- | 1269 // ----------------------------------- |
1270 Label miss; | 1270 Label miss; |
1271 __ IncrementCounter(&Counters::keyed_load_string_length, 1, r1, r3); | 1271 __ IncrementCounter(&COUNTER(keyed_load_string_length), 1, r1, r3); |
1272 | 1272 |
1273 __ ldr(r2, MemOperand(sp)); | 1273 __ ldr(r2, MemOperand(sp)); |
1274 __ ldr(r0, MemOperand(sp, kPointerSize)); // receiver | 1274 __ ldr(r0, MemOperand(sp, kPointerSize)); // receiver |
1275 | 1275 |
1276 __ cmp(r2, Operand(Handle<String>(name))); | 1276 __ cmp(r2, Operand(Handle<String>(name))); |
1277 __ b(ne, &miss); | 1277 __ b(ne, &miss); |
1278 | 1278 |
1279 GenerateLoadStringLength2(masm(), r0, r1, r3, &miss); | 1279 GenerateLoadStringLength2(masm(), r0, r1, r3, &miss); |
1280 __ bind(&miss); | 1280 __ bind(&miss); |
1281 __ DecrementCounter(&Counters::keyed_load_string_length, 1, r1, r3); | 1281 __ DecrementCounter(&COUNTER(keyed_load_string_length), 1, r1, r3); |
1282 | 1282 |
1283 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 1283 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
1284 | 1284 |
1285 return GetCode(CALLBACKS, name); | 1285 return GetCode(CALLBACKS, name); |
1286 } | 1286 } |
1287 | 1287 |
1288 | 1288 |
1289 // TODO(1224671): implement the fast case. | 1289 // TODO(1224671): implement the fast case. |
1290 Object* KeyedLoadStubCompiler::CompileLoadFunctionPrototype(String* name) { | 1290 Object* KeyedLoadStubCompiler::CompileLoadFunctionPrototype(String* name) { |
1291 // ----------- S t a t e ------------- | 1291 // ----------- S t a t e ------------- |
(...skipping 12 matching lines...) Expand all Loading... |
1304 Map* transition, | 1304 Map* transition, |
1305 String* name) { | 1305 String* name) { |
1306 // ----------- S t a t e ------------- | 1306 // ----------- S t a t e ------------- |
1307 // -- r0 : value | 1307 // -- r0 : value |
1308 // -- r2 : name | 1308 // -- r2 : name |
1309 // -- lr : return address | 1309 // -- lr : return address |
1310 // -- [sp] : receiver | 1310 // -- [sp] : receiver |
1311 // ----------------------------------- | 1311 // ----------------------------------- |
1312 Label miss; | 1312 Label miss; |
1313 | 1313 |
1314 __ IncrementCounter(&Counters::keyed_store_field, 1, r1, r3); | 1314 __ IncrementCounter(&COUNTER(keyed_store_field), 1, r1, r3); |
1315 | 1315 |
1316 // Check that the name has not changed. | 1316 // Check that the name has not changed. |
1317 __ cmp(r2, Operand(Handle<String>(name))); | 1317 __ cmp(r2, Operand(Handle<String>(name))); |
1318 __ b(ne, &miss); | 1318 __ b(ne, &miss); |
1319 | 1319 |
1320 // Load receiver from the stack. | 1320 // Load receiver from the stack. |
1321 __ ldr(r3, MemOperand(sp)); | 1321 __ ldr(r3, MemOperand(sp)); |
1322 // r1 is used as scratch register, r3 and r2 might be clobbered. | 1322 // r1 is used as scratch register, r3 and r2 might be clobbered. |
1323 GenerateStoreField(masm(), | 1323 GenerateStoreField(masm(), |
1324 Builtins::StoreIC_ExtendStorage, | 1324 Builtins::StoreIC_ExtendStorage, |
1325 object, | 1325 object, |
1326 index, | 1326 index, |
1327 transition, | 1327 transition, |
1328 r3, r2, r1, | 1328 r3, r2, r1, |
1329 &miss); | 1329 &miss); |
1330 __ bind(&miss); | 1330 __ bind(&miss); |
1331 | 1331 |
1332 __ DecrementCounter(&Counters::keyed_store_field, 1, r1, r3); | 1332 __ DecrementCounter(&COUNTER(keyed_store_field), 1, r1, r3); |
1333 __ mov(r2, Operand(Handle<String>(name))); // restore name register. | 1333 __ mov(r2, Operand(Handle<String>(name))); // restore name register. |
1334 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Miss)); | 1334 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Miss)); |
1335 __ Jump(ic, RelocInfo::CODE_TARGET); | 1335 __ Jump(ic, RelocInfo::CODE_TARGET); |
1336 | 1336 |
1337 // Return the generated code. | 1337 // Return the generated code. |
1338 return GetCode(transition == NULL ? FIELD : MAP_TRANSITION, name); | 1338 return GetCode(transition == NULL ? FIELD : MAP_TRANSITION, name); |
1339 } | 1339 } |
1340 | 1340 |
1341 | 1341 |
1342 Object* ConstructStubCompiler::CompileConstructStub( | 1342 Object* ConstructStubCompiler::CompileConstructStub( |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1459 // Move argc to r1 and the JSObject to return to r0 and tag it. | 1459 // Move argc to r1 and the JSObject to return to r0 and tag it. |
1460 __ mov(r1, r0); | 1460 __ mov(r1, r0); |
1461 __ mov(r0, r4); | 1461 __ mov(r0, r4); |
1462 __ orr(r0, r0, Operand(kHeapObjectTag)); | 1462 __ orr(r0, r0, Operand(kHeapObjectTag)); |
1463 | 1463 |
1464 // r0: JSObject | 1464 // r0: JSObject |
1465 // r1: argc | 1465 // r1: argc |
1466 // Remove caller arguments and receiver from the stack and return. | 1466 // Remove caller arguments and receiver from the stack and return. |
1467 __ add(sp, sp, Operand(r1, LSL, kPointerSizeLog2)); | 1467 __ add(sp, sp, Operand(r1, LSL, kPointerSizeLog2)); |
1468 __ add(sp, sp, Operand(kPointerSize)); | 1468 __ add(sp, sp, Operand(kPointerSize)); |
1469 __ IncrementCounter(&Counters::constructed_objects, 1, r1, r2); | 1469 __ IncrementCounter(&COUNTER(constructed_objects), 1, r1, r2); |
1470 __ IncrementCounter(&Counters::constructed_objects_stub, 1, r1, r2); | 1470 __ IncrementCounter(&COUNTER(constructed_objects_stub), 1, r1, r2); |
1471 __ Jump(lr); | 1471 __ Jump(lr); |
1472 | 1472 |
1473 // Jump to the generic stub in case the specialized code cannot handle the | 1473 // Jump to the generic stub in case the specialized code cannot handle the |
1474 // construction. | 1474 // construction. |
1475 __ bind(&generic_stub_call); | 1475 __ bind(&generic_stub_call); |
1476 Code* code = Builtins::builtin(Builtins::JSConstructStubGeneric); | 1476 Code* code = Builtins::builtin(Builtins::JSConstructStubGeneric); |
1477 Handle<Code> generic_construct_stub(code); | 1477 Handle<Code> generic_construct_stub(code); |
1478 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); | 1478 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); |
1479 | 1479 |
1480 // Return the generated code. | 1480 // Return the generated code. |
1481 return GetCode(); | 1481 return GetCode(); |
1482 } | 1482 } |
1483 | 1483 |
1484 | 1484 |
1485 #undef __ | 1485 #undef __ |
1486 | 1486 |
1487 } } // namespace v8::internal | 1487 } } // namespace v8::internal |
OLD | NEW |