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 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 // Check that the maps haven't changed. | 439 // Check that the maps haven't changed. |
440 Register reg = | 440 Register reg = |
441 CheckPrototypes(object, receiver, holder, scratch1, scratch2, name, miss); | 441 CheckPrototypes(object, receiver, holder, scratch1, scratch2, name, miss); |
442 | 442 |
443 // Return the constant value. | 443 // Return the constant value. |
444 __ mov(r0, Operand(Handle<Object>(value))); | 444 __ mov(r0, Operand(Handle<Object>(value))); |
445 __ Ret(); | 445 __ Ret(); |
446 } | 446 } |
447 | 447 |
448 | 448 |
449 void StubCompiler::GenerateLoadCallback(JSObject* object, | 449 bool StubCompiler::GenerateLoadCallback(JSObject* object, |
450 JSObject* holder, | 450 JSObject* holder, |
451 Register receiver, | 451 Register receiver, |
452 Register name_reg, | 452 Register name_reg, |
453 Register scratch1, | 453 Register scratch1, |
454 Register scratch2, | 454 Register scratch2, |
455 AccessorInfo* callback, | 455 AccessorInfo* callback, |
456 String* name, | 456 String* name, |
457 Label* miss) { | 457 Label* miss, |
| 458 Failure** failure) { |
458 // Check that the receiver isn't a smi. | 459 // Check that the receiver isn't a smi. |
459 __ tst(receiver, Operand(kSmiTagMask)); | 460 __ tst(receiver, Operand(kSmiTagMask)); |
460 __ b(eq, miss); | 461 __ b(eq, miss); |
461 | 462 |
462 // Check that the maps haven't changed. | 463 // Check that the maps haven't changed. |
463 Register reg = | 464 Register reg = |
464 CheckPrototypes(object, receiver, holder, scratch1, scratch2, name, miss); | 465 CheckPrototypes(object, receiver, holder, scratch1, scratch2, name, miss); |
465 | 466 |
466 // Push the arguments on the JS stack of the caller. | 467 // Push the arguments on the JS stack of the caller. |
467 __ push(receiver); // receiver | 468 __ push(receiver); // receiver |
468 __ push(reg); // holder | 469 __ push(reg); // holder |
469 __ mov(ip, Operand(Handle<AccessorInfo>(callback))); // callback data | 470 __ mov(ip, Operand(Handle<AccessorInfo>(callback))); // callback data |
470 __ push(ip); | 471 __ push(ip); |
471 __ ldr(reg, FieldMemOperand(ip, AccessorInfo::kDataOffset)); | 472 __ ldr(reg, FieldMemOperand(ip, AccessorInfo::kDataOffset)); |
472 __ push(reg); | 473 __ push(reg); |
473 __ push(name_reg); // name | 474 __ push(name_reg); // name |
474 | 475 |
475 // Do tail-call to the runtime system. | 476 // Do tail-call to the runtime system. |
476 ExternalReference load_callback_property = | 477 ExternalReference load_callback_property = |
477 ExternalReference(IC_Utility(IC::kLoadCallbackProperty)); | 478 ExternalReference(IC_Utility(IC::kLoadCallbackProperty)); |
478 __ TailCallRuntime(load_callback_property, 5, 1); | 479 __ TailCallRuntime(load_callback_property, 5, 1); |
| 480 |
| 481 return true; |
479 } | 482 } |
480 | 483 |
481 | 484 |
482 void StubCompiler::GenerateLoadInterceptor(JSObject* object, | 485 void StubCompiler::GenerateLoadInterceptor(JSObject* object, |
483 JSObject* holder, | 486 JSObject* holder, |
484 LookupResult* lookup, | 487 LookupResult* lookup, |
485 Register receiver, | 488 Register receiver, |
486 Register name_reg, | 489 Register name_reg, |
487 Register scratch1, | 490 Register scratch1, |
488 Register scratch2, | 491 Register scratch2, |
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
996 | 999 |
997 GenerateLoadField(object, holder, r0, r3, r1, index, name, &miss); | 1000 GenerateLoadField(object, holder, r0, r3, r1, index, name, &miss); |
998 __ bind(&miss); | 1001 __ bind(&miss); |
999 GenerateLoadMiss(masm(), Code::LOAD_IC); | 1002 GenerateLoadMiss(masm(), Code::LOAD_IC); |
1000 | 1003 |
1001 // Return the generated code. | 1004 // Return the generated code. |
1002 return GetCode(FIELD, name); | 1005 return GetCode(FIELD, name); |
1003 } | 1006 } |
1004 | 1007 |
1005 | 1008 |
1006 Object* LoadStubCompiler::CompileLoadCallback(JSObject* object, | 1009 Object* LoadStubCompiler::CompileLoadCallback(String* name, |
| 1010 JSObject* object, |
1007 JSObject* holder, | 1011 JSObject* holder, |
1008 AccessorInfo* callback, | 1012 AccessorInfo* callback) { |
1009 String* name) { | |
1010 // ----------- S t a t e ------------- | 1013 // ----------- S t a t e ------------- |
1011 // -- r2 : name | 1014 // -- r2 : name |
1012 // -- lr : return address | 1015 // -- lr : return address |
1013 // -- [sp] : receiver | 1016 // -- [sp] : receiver |
1014 // ----------------------------------- | 1017 // ----------------------------------- |
1015 Label miss; | 1018 Label miss; |
1016 | 1019 |
1017 __ ldr(r0, MemOperand(sp, 0)); | 1020 __ ldr(r0, MemOperand(sp, 0)); |
1018 GenerateLoadCallback(object, holder, r0, r2, r3, r1, callback, name, &miss); | 1021 Failure* failure = Failure::InternalError(); |
| 1022 bool success = GenerateLoadCallback(object, holder, r0, r2, r3, r1, |
| 1023 callback, name, &miss, &failure); |
| 1024 if (!success) return failure; |
| 1025 |
1019 __ bind(&miss); | 1026 __ bind(&miss); |
1020 GenerateLoadMiss(masm(), Code::LOAD_IC); | 1027 GenerateLoadMiss(masm(), Code::LOAD_IC); |
1021 | 1028 |
1022 // Return the generated code. | 1029 // Return the generated code. |
1023 return GetCode(CALLBACKS, name); | 1030 return GetCode(CALLBACKS, name); |
1024 } | 1031 } |
1025 | 1032 |
1026 | 1033 |
1027 Object* LoadStubCompiler::CompileLoadConstant(JSObject* object, | 1034 Object* LoadStubCompiler::CompileLoadConstant(JSObject* object, |
1028 JSObject* holder, | 1035 JSObject* holder, |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1161 // -- sp[4] : receiver | 1168 // -- sp[4] : receiver |
1162 // ----------------------------------- | 1169 // ----------------------------------- |
1163 Label miss; | 1170 Label miss; |
1164 | 1171 |
1165 __ ldr(r2, MemOperand(sp, 0)); | 1172 __ ldr(r2, MemOperand(sp, 0)); |
1166 __ ldr(r0, MemOperand(sp, kPointerSize)); | 1173 __ ldr(r0, MemOperand(sp, kPointerSize)); |
1167 | 1174 |
1168 __ cmp(r2, Operand(Handle<String>(name))); | 1175 __ cmp(r2, Operand(Handle<String>(name))); |
1169 __ b(ne, &miss); | 1176 __ b(ne, &miss); |
1170 | 1177 |
1171 GenerateLoadCallback(receiver, holder, r0, r2, r3, r1, callback, name, &miss); | 1178 Failure* failure = Failure::InternalError(); |
| 1179 bool success = GenerateLoadCallback(receiver, holder, r0, r2, r3, r1, |
| 1180 callback, name, &miss, &failure); |
| 1181 if (!success) return failure; |
| 1182 |
1172 __ bind(&miss); | 1183 __ bind(&miss); |
1173 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 1184 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
1174 | 1185 |
1175 return GetCode(CALLBACKS, name); | 1186 return GetCode(CALLBACKS, name); |
1176 } | 1187 } |
1177 | 1188 |
1178 | 1189 |
1179 Object* KeyedLoadStubCompiler::CompileLoadConstant(String* name, | 1190 Object* KeyedLoadStubCompiler::CompileLoadConstant(String* name, |
1180 JSObject* receiver, | 1191 JSObject* receiver, |
1181 JSObject* holder, | 1192 JSObject* holder, |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1478 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); | 1489 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); |
1479 | 1490 |
1480 // Return the generated code. | 1491 // Return the generated code. |
1481 return GetCode(); | 1492 return GetCode(); |
1482 } | 1493 } |
1483 | 1494 |
1484 | 1495 |
1485 #undef __ | 1496 #undef __ |
1486 | 1497 |
1487 } } // namespace v8::internal | 1498 } } // namespace v8::internal |
OLD | NEW |