Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/ic/ic.h" | 5 #include "src/ic/ic.h" |
| 6 | 6 |
| 7 #include <iostream> | 7 #include <iostream> |
| 8 | 8 |
| 9 #include "src/accessors.h" | 9 #include "src/accessors.h" |
| 10 #include "src/api-arguments-inl.h" | 10 #include "src/api-arguments-inl.h" |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 185 StackFrameIterator it(isolate); | 185 StackFrameIterator it(isolate); |
| 186 for (int i = 0; i < depth + 1; i++) it.Advance(); | 186 for (int i = 0; i < depth + 1; i++) it.Advance(); |
| 187 StackFrame* frame = it.frame(); | 187 StackFrame* frame = it.frame(); |
| 188 DCHECK(fp == frame->fp() && pc_address == frame->pc_address()); | 188 DCHECK(fp == frame->fp() && pc_address == frame->pc_address()); |
| 189 #endif | 189 #endif |
| 190 // For interpreted functions, some bytecode handlers construct a | 190 // For interpreted functions, some bytecode handlers construct a |
| 191 // frame. We have to skip the constructed frame to find the interpreted | 191 // frame. We have to skip the constructed frame to find the interpreted |
| 192 // function's frame. Check if the there is an additional frame, and if there | 192 // function's frame. Check if the there is an additional frame, and if there |
| 193 // is skip this frame. However, the pc should not be updated. The call to | 193 // is skip this frame. However, the pc should not be updated. The call to |
| 194 // ICs happen from bytecode handlers. | 194 // ICs happen from bytecode handlers. |
| 195 // TODO(rmcilroy): Remove this once bytecode handlers don't need a frame. | |
|
mythria
2016/10/31 15:47:37
Do we need this TODO? since we need to call into r
rmcilroy
2016/11/01 13:01:02
Yeah I had plans to avoid needing to build the fra
mythria
2016/11/01 15:55:53
Done.
| |
| 195 Object* frame_type = | 196 Object* frame_type = |
| 196 Memory::Object_at(fp + TypedFrameConstants::kFrameTypeOffset); | 197 Memory::Object_at(fp + TypedFrameConstants::kFrameTypeOffset); |
| 197 if (frame_type == Smi::FromInt(StackFrame::STUB)) { | 198 if (frame_type == Smi::FromInt(StackFrame::STUB)) { |
| 198 fp = Memory::Address_at(fp + TypedFrameConstants::kCallerFPOffset); | 199 fp = Memory::Address_at(fp + TypedFrameConstants::kCallerFPOffset); |
| 199 } | 200 } |
| 201 | |
| 200 fp_ = fp; | 202 fp_ = fp; |
| 203 | |
|
rmcilroy
2016/11/01 13:01:02
Intended changes?
mythria
2016/11/01 15:55:53
No. Removed them. Done.
| |
| 201 if (FLAG_enable_embedded_constant_pool) { | 204 if (FLAG_enable_embedded_constant_pool) { |
| 202 constant_pool_address_ = constant_pool; | 205 constant_pool_address_ = constant_pool; |
| 203 } | 206 } |
| 204 pc_address_ = StackFrame::ResolveReturnAddressLocation(pc_address); | 207 pc_address_ = StackFrame::ResolveReturnAddressLocation(pc_address); |
| 205 Code* target = this->target(); | 208 Code* target = this->target(); |
| 206 kind_ = target->kind(); | 209 kind_ = target->kind(); |
| 207 state_ = UseVector() ? nexus->StateFromFeedback() : StateFromCode(target); | 210 state_ = UseVector() ? nexus->StateFromFeedback() : StateFromCode(target); |
| 208 old_state_ = state_; | 211 old_state_ = state_; |
| 209 extra_ic_state_ = target->extra_ic_state(); | 212 extra_ic_state_ = target->extra_ic_state(); |
| 210 } | 213 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 243 return UNINITIALIZED; | 246 return UNINITIALIZED; |
| 244 } | 247 } |
| 245 } | 248 } |
| 246 | 249 |
| 247 SharedFunctionInfo* IC::GetSharedFunctionInfo() const { | 250 SharedFunctionInfo* IC::GetSharedFunctionInfo() const { |
| 248 // Compute the JavaScript frame for the frame pointer of this IC | 251 // Compute the JavaScript frame for the frame pointer of this IC |
| 249 // structure. We need this to be able to find the function | 252 // structure. We need this to be able to find the function |
| 250 // corresponding to the frame. | 253 // corresponding to the frame. |
| 251 StackFrameIterator it(isolate()); | 254 StackFrameIterator it(isolate()); |
| 252 while (it.frame()->fp() != this->fp()) it.Advance(); | 255 while (it.frame()->fp() != this->fp()) it.Advance(); |
| 253 if (it.frame()->type() == StackFrame::STUB) { | 256 // For ignition, bytecode handlers build a stub frame. This frame should be |
| 254 // We might need to advance over bytecode handler frame for Ignition. | 257 // skipped in the constructor. DCHECK to be sure we skipped the frame. |
| 255 it.Advance(); | 258 DCHECK(it.frame()->type() != StackFrame::STUB); |
|
mythria
2016/10/31 15:47:37
I wanted to add a check to see if it is the correc
rmcilroy
2016/11/01 13:01:02
Hmm, we could probably just remove this - I'm not
mythria
2016/11/01 15:55:54
Removed it. I wasn't very happy with that check ei
| |
| 256 } | 259 |
| 257 JavaScriptFrame* frame = JavaScriptFrame::cast(it.frame()); | 260 JavaScriptFrame* frame = JavaScriptFrame::cast(it.frame()); |
| 258 // Find the function on the stack and both the active code for the | 261 // Find the function on the stack and both the active code for the |
| 259 // function and the original code. | 262 // function and the original code. |
| 260 JSFunction* function = frame->function(); | 263 JSFunction* function = frame->function(); |
| 261 return function->shared(); | 264 return function->shared(); |
| 262 } | 265 } |
| 263 | 266 |
| 264 | 267 |
| 265 Code* IC::GetCode() const { | 268 Code* IC::GetCode() const { |
| 266 HandleScope scope(isolate()); | 269 HandleScope scope(isolate()); |
| (...skipping 2802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3069 DCHECK_EQ(LookupIterator::INTERCEPTOR, it.state()); | 3072 DCHECK_EQ(LookupIterator::INTERCEPTOR, it.state()); |
| 3070 it.Next(); | 3073 it.Next(); |
| 3071 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, | 3074 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, |
| 3072 Object::GetProperty(&it)); | 3075 Object::GetProperty(&it)); |
| 3073 } | 3076 } |
| 3074 | 3077 |
| 3075 return *result; | 3078 return *result; |
| 3076 } | 3079 } |
| 3077 } // namespace internal | 3080 } // namespace internal |
| 3078 } // namespace v8 | 3081 } // namespace v8 |
| OLD | NEW |