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 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 | 511 |
512 StoreStubCompiler compiler(isolate_, strict_mode); | 512 StoreStubCompiler compiler(isolate_, strict_mode); |
513 Handle<Code> code = compiler.CompileStoreGlobal(receiver, cell, name); | 513 Handle<Code> code = compiler.CompileStoreGlobal(receiver, cell, name); |
514 PROFILE(isolate_, CodeCreateEvent(Logger::STORE_IC_TAG, *code, *name)); | 514 PROFILE(isolate_, CodeCreateEvent(Logger::STORE_IC_TAG, *code, *name)); |
515 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code)); | 515 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code)); |
516 JSObject::UpdateMapCodeCache(receiver, name, code); | 516 JSObject::UpdateMapCodeCache(receiver, name, code); |
517 return code; | 517 return code; |
518 } | 518 } |
519 | 519 |
520 | 520 |
521 Handle<Code> StoreStubCompiler::CompileStoreCallback( | |
522 Handle<JSObject> object, | |
523 Handle<AccessorInfo> callback, | |
524 Handle<String> name) { | |
525 CALL_HEAP_FUNCTION(isolate(), | |
526 (set_failure(NULL), | |
527 CompileStoreCallback(*object, *callback, *name)), | |
528 Code); | |
529 } | |
530 | |
531 | |
532 Handle<Code> StubCache::ComputeStoreCallback(Handle<String> name, | 521 Handle<Code> StubCache::ComputeStoreCallback(Handle<String> name, |
533 Handle<JSObject> receiver, | 522 Handle<JSObject> receiver, |
534 Handle<AccessorInfo> callback, | 523 Handle<AccessorInfo> callback, |
535 StrictModeFlag strict_mode) { | 524 StrictModeFlag strict_mode) { |
536 ASSERT(v8::ToCData<Address>(callback->setter()) != 0); | 525 ASSERT(v8::ToCData<Address>(callback->setter()) != 0); |
537 Code::Flags flags = Code::ComputeMonomorphicFlags( | 526 Code::Flags flags = Code::ComputeMonomorphicFlags( |
538 Code::STORE_IC, CALLBACKS, strict_mode); | 527 Code::STORE_IC, CALLBACKS, strict_mode); |
539 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags)); | 528 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags)); |
540 if (probe->IsCode()) return Handle<Code>::cast(probe); | 529 if (probe->IsCode()) return Handle<Code>::cast(probe); |
541 | 530 |
542 StoreStubCompiler compiler(isolate_, strict_mode); | 531 StoreStubCompiler compiler(isolate_, strict_mode); |
543 Handle<Code> code = compiler.CompileStoreCallback(receiver, callback, name); | 532 Handle<Code> code = compiler.CompileStoreCallback(receiver, callback, name); |
544 PROFILE(isolate_, CodeCreateEvent(Logger::STORE_IC_TAG, *code, *name)); | 533 PROFILE(isolate_, CodeCreateEvent(Logger::STORE_IC_TAG, *code, *name)); |
545 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code)); | 534 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code)); |
546 JSObject::UpdateMapCodeCache(receiver, name, code); | 535 JSObject::UpdateMapCodeCache(receiver, name, code); |
547 return code; | 536 return code; |
548 } | 537 } |
549 | 538 |
550 | 539 |
551 Handle<Code> StoreStubCompiler::CompileStoreInterceptor(Handle<JSObject> object, | |
552 Handle<String> name) { | |
553 CALL_HEAP_FUNCTION(isolate(), | |
554 (set_failure(NULL), | |
555 CompileStoreInterceptor(*object, *name)), | |
556 Code); | |
557 } | |
558 | |
559 | |
560 Handle<Code> StubCache::ComputeStoreInterceptor(Handle<String> name, | 540 Handle<Code> StubCache::ComputeStoreInterceptor(Handle<String> name, |
561 Handle<JSObject> receiver, | 541 Handle<JSObject> receiver, |
562 StrictModeFlag strict_mode) { | 542 StrictModeFlag strict_mode) { |
563 Code::Flags flags = Code::ComputeMonomorphicFlags( | 543 Code::Flags flags = Code::ComputeMonomorphicFlags( |
564 Code::STORE_IC, INTERCEPTOR, strict_mode); | 544 Code::STORE_IC, INTERCEPTOR, strict_mode); |
565 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags)); | 545 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags)); |
566 if (probe->IsCode()) return Handle<Code>::cast(probe); | 546 if (probe->IsCode()) return Handle<Code>::cast(probe); |
567 | 547 |
568 StoreStubCompiler compiler(isolate_, strict_mode); | 548 StoreStubCompiler compiler(isolate_, strict_mode); |
569 Handle<Code> code = compiler.CompileStoreInterceptor(receiver, name); | 549 Handle<Code> code = compiler.CompileStoreInterceptor(receiver, name); |
(...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1551 Handle<String> name) { | 1531 Handle<String> name) { |
1552 Code::Flags flags = | 1532 Code::Flags flags = |
1553 Code::ComputeMonomorphicFlags(Code::STORE_IC, type, strict_mode_); | 1533 Code::ComputeMonomorphicFlags(Code::STORE_IC, type, strict_mode_); |
1554 Handle<Code> code = GetCodeWithFlags(flags, name); | 1534 Handle<Code> code = GetCodeWithFlags(flags, name); |
1555 PROFILE(isolate(), CodeCreateEvent(Logger::STORE_IC_TAG, *code, *name)); | 1535 PROFILE(isolate(), CodeCreateEvent(Logger::STORE_IC_TAG, *code, *name)); |
1556 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code)); | 1536 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code)); |
1557 return code; | 1537 return code; |
1558 } | 1538 } |
1559 | 1539 |
1560 | 1540 |
1561 // TODO(ulan): Eliminate this function when the stub cache is fully | |
1562 // handlified. | |
1563 MaybeObject* StoreStubCompiler::TryGetCode(PropertyType type, String* name) { | |
1564 Code::Flags flags = | |
1565 Code::ComputeMonomorphicFlags(Code::STORE_IC, type, strict_mode_); | |
1566 MaybeObject* result = TryGetCodeWithFlags(flags, name); | |
1567 if (!result->IsFailure()) { | |
1568 PROFILE(isolate(), | |
1569 CodeCreateEvent(Logger::STORE_IC_TAG, | |
1570 Code::cast(result->ToObjectUnchecked()), | |
1571 name)); | |
1572 GDBJIT(AddCode(GDBJITInterface::STORE_IC, | |
1573 name, | |
1574 Code::cast(result->ToObjectUnchecked()))); | |
1575 } | |
1576 return result; | |
1577 } | |
1578 | |
1579 | |
1580 Handle<Code> KeyedStoreStubCompiler::GetCode(PropertyType type, | 1541 Handle<Code> KeyedStoreStubCompiler::GetCode(PropertyType type, |
1581 Handle<String> name, | 1542 Handle<String> name, |
1582 InlineCacheState state) { | 1543 InlineCacheState state) { |
1583 Code::Flags flags = | 1544 Code::Flags flags = |
1584 Code::ComputeFlags(Code::KEYED_STORE_IC, state, strict_mode_, type); | 1545 Code::ComputeFlags(Code::KEYED_STORE_IC, state, strict_mode_, type); |
1585 Handle<Code> code = GetCodeWithFlags(flags, name); | 1546 Handle<Code> code = GetCodeWithFlags(flags, name); |
1586 PROFILE(isolate(), CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, *code, *name)); | 1547 PROFILE(isolate(), CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, *code, *name)); |
1587 GDBJIT(AddCode(GDBJITInterface::KEYED_STORE_IC, *name, *code)); | 1548 GDBJIT(AddCode(GDBJITInterface::KEYED_STORE_IC, *name, *code)); |
1588 return code; | 1549 return code; |
1589 } | 1550 } |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1775 expected_receiver_type_ = | 1736 expected_receiver_type_ = |
1776 FunctionTemplateInfo::cast(signature->receiver()); | 1737 FunctionTemplateInfo::cast(signature->receiver()); |
1777 } | 1738 } |
1778 } | 1739 } |
1779 | 1740 |
1780 is_simple_api_call_ = true; | 1741 is_simple_api_call_ = true; |
1781 } | 1742 } |
1782 | 1743 |
1783 | 1744 |
1784 } } // namespace v8::internal | 1745 } } // namespace v8::internal |
OLD | NEW |