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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 | 98 |
99 // Copy the generated code into a heap object. | 99 // Copy the generated code into a heap object. |
100 Code::Flags flags = Code::ComputeFlags( | 100 Code::Flags flags = Code::ComputeFlags( |
101 static_cast<Code::Kind>(GetCodeKind()), GetICState(), GetExtraICState()); | 101 static_cast<Code::Kind>(GetCodeKind()), GetICState(), GetExtraICState()); |
102 Handle<Code> new_object = factory->NewCode( | 102 Handle<Code> new_object = factory->NewCode( |
103 desc, flags, masm.CodeObject(), NeedsImmovableCode()); | 103 desc, flags, masm.CodeObject(), NeedsImmovableCode()); |
104 return new_object; | 104 return new_object; |
105 } | 105 } |
106 | 106 |
107 | 107 |
108 Handle<Code> CodeStub::GetCode() { | 108 Handle<Code> CodeStub::GetCode(Isolate* isolate) { |
109 Isolate* isolate = Isolate::Current(); | |
110 Factory* factory = isolate->factory(); | 109 Factory* factory = isolate->factory(); |
111 Heap* heap = isolate->heap(); | 110 Heap* heap = isolate->heap(); |
112 Code* code; | 111 Code* code; |
113 if (UseSpecialCache() | 112 if (UseSpecialCache() |
114 ? FindCodeInSpecialCache(&code, isolate) | 113 ? FindCodeInSpecialCache(&code, isolate) |
115 : FindCodeInCache(&code, isolate)) { | 114 : FindCodeInCache(&code, isolate)) { |
116 ASSERT(IsPregenerated() == code->is_pregenerated()); | 115 ASSERT(IsPregenerated() == code->is_pregenerated()); |
117 return Handle<Code>(code); | 116 return Handle<Code>(code); |
118 } | 117 } |
119 | 118 |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
597 GenerateMapChangeElementsTransition(masm, mode, &fail); | 596 GenerateMapChangeElementsTransition(masm, mode, &fail); |
598 } else { | 597 } else { |
599 UNREACHABLE(); | 598 UNREACHABLE(); |
600 } | 599 } |
601 } | 600 } |
602 masm->bind(&fail); | 601 masm->bind(&fail); |
603 KeyedStoreIC::GenerateRuntimeSetProperty(masm, strict_mode_); | 602 KeyedStoreIC::GenerateRuntimeSetProperty(masm, strict_mode_); |
604 } | 603 } |
605 | 604 |
606 | 605 |
607 void StubFailureTrampolineStub::GenerateAheadOfTime() { | 606 void StubFailureTrampolineStub::GenerateAheadOfTime(Isolate* isolate) { |
608 int i = 0; | 607 int i = 0; |
609 for (; i <= StubFailureTrampolineStub::kMaxExtraExpressionStackCount; ++i) { | 608 for (; i <= StubFailureTrampolineStub::kMaxExtraExpressionStackCount; ++i) { |
610 StubFailureTrampolineStub(i).GetCode(); | 609 StubFailureTrampolineStub(i).GetCode(isolate); |
611 } | 610 } |
612 } | 611 } |
613 | 612 |
614 | 613 |
615 FunctionEntryHook ProfileEntryHookStub::entry_hook_ = NULL; | 614 FunctionEntryHook ProfileEntryHookStub::entry_hook_ = NULL; |
616 | 615 |
617 | 616 |
618 void ProfileEntryHookStub::EntryHookTrampoline(intptr_t function, | 617 void ProfileEntryHookStub::EntryHookTrampoline(intptr_t function, |
619 intptr_t stack_pointer) { | 618 intptr_t stack_pointer) { |
620 if (entry_hook_ != NULL) | 619 if (entry_hook_ != NULL) |
621 entry_hook_(function, stack_pointer); | 620 entry_hook_(function, stack_pointer); |
622 } | 621 } |
623 | 622 |
624 | 623 |
625 bool ProfileEntryHookStub::SetFunctionEntryHook(FunctionEntryHook entry_hook) { | 624 bool ProfileEntryHookStub::SetFunctionEntryHook(FunctionEntryHook entry_hook) { |
626 // We don't allow setting a new entry hook over one that's | 625 // We don't allow setting a new entry hook over one that's |
627 // already active, as the hooks won't stack. | 626 // already active, as the hooks won't stack. |
628 if (entry_hook != 0 && entry_hook_ != 0) | 627 if (entry_hook != 0 && entry_hook_ != 0) |
629 return false; | 628 return false; |
630 | 629 |
631 entry_hook_ = entry_hook; | 630 entry_hook_ = entry_hook; |
632 return true; | 631 return true; |
633 } | 632 } |
634 | 633 |
635 | 634 |
636 } } // namespace v8::internal | 635 } } // namespace v8::internal |
OLD | NEW |