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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 105 |
106 #else | 106 #else |
107 #define TRACE_GENERIC_IC(type, reason) | 107 #define TRACE_GENERIC_IC(type, reason) |
108 #endif // DEBUG | 108 #endif // DEBUG |
109 | 109 |
110 #define TRACE_IC(type, name, old_state, new_target) \ | 110 #define TRACE_IC(type, name, old_state, new_target) \ |
111 ASSERT((TraceIC(type, name, old_state, new_target), true)) | 111 ASSERT((TraceIC(type, name, old_state, new_target), true)) |
112 | 112 |
113 IC::IC(FrameDepth depth, Isolate* isolate) : isolate_(isolate) { | 113 IC::IC(FrameDepth depth, Isolate* isolate) : isolate_(isolate) { |
114 ASSERT(isolate == Isolate::Current()); | 114 ASSERT(isolate == Isolate::Current()); |
115 // To improve the performance of the (much used) IC code, we unfold | |
116 // a few levels of the stack frame iteration code. This yields a | |
117 // ~35% speedup when running DeltaBlue with the '--nouse-ic' flag. | |
118 const Address entry = | |
119 Isolate::c_entry_fp(isolate->thread_local_top()); | |
120 Address* pc_address = | |
121 reinterpret_cast<Address*>(entry + ExitFrameConstants::kCallerPCOffset); | |
122 Address fp = Memory::Address_at(entry + ExitFrameConstants::kCallerFPOffset); | |
123 // If there's another JavaScript frame on the stack, we need to look | |
124 // one frame further down the stack to find the frame pointer and | |
125 // the return address stack slot. | |
126 if (depth == EXTRA_CALL_FRAME) { | |
127 const int kCallerPCOffset = StandardFrameConstants::kCallerPCOffset; | |
128 pc_address = reinterpret_cast<Address*>(fp + kCallerPCOffset); | |
129 fp = Memory::Address_at(fp + StandardFrameConstants::kCallerFPOffset); | |
130 } | |
131 #ifdef DEBUG | |
132 StackFrameIterator it; | 115 StackFrameIterator it; |
133 for (int i = 0; i < depth + 1; i++) it.Advance(); | 116 for (int i = 0; i < depth + 1; i++) it.Advance(); |
| 117 // Skip StubFailureTrampolineFrames |
| 118 if (it.frame()->is_stub_failure_trampoline()) { |
| 119 it.Advance(); |
| 120 } |
134 StackFrame* frame = it.frame(); | 121 StackFrame* frame = it.frame(); |
135 ASSERT(fp == frame->fp() && pc_address == frame->pc_address()); | 122 fp_ = frame->fp(); |
136 #endif | 123 pc_address_ = frame->pc_address(); |
137 fp_ = fp; | |
138 pc_address_ = pc_address; | |
139 } | 124 } |
140 | 125 |
141 | 126 |
142 #ifdef ENABLE_DEBUGGER_SUPPORT | 127 #ifdef ENABLE_DEBUGGER_SUPPORT |
143 Address IC::OriginalCodeAddress() const { | 128 Address IC::OriginalCodeAddress() const { |
144 HandleScope scope; | 129 HandleScope scope; |
145 // Compute the JavaScript frame for the frame pointer of this IC | 130 // Compute the JavaScript frame for the frame pointer of this IC |
146 // structure. We need this to be able to find the function | 131 // structure. We need this to be able to find the function |
147 // corresponding to the frame. | 132 // corresponding to the frame. |
148 StackFrameIterator it; | 133 StackFrameIterator it; |
(...skipping 2523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2672 #undef ADDR | 2657 #undef ADDR |
2673 }; | 2658 }; |
2674 | 2659 |
2675 | 2660 |
2676 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 2661 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
2677 return IC_utilities[id]; | 2662 return IC_utilities[id]; |
2678 } | 2663 } |
2679 | 2664 |
2680 | 2665 |
2681 } } // namespace v8::internal | 2666 } } // namespace v8::internal |
OLD | NEW |