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> |
| 8 |
7 #include "src/accessors.h" | 9 #include "src/accessors.h" |
8 #include "src/api-arguments-inl.h" | 10 #include "src/api-arguments-inl.h" |
9 #include "src/api.h" | 11 #include "src/api.h" |
10 #include "src/arguments.h" | 12 #include "src/arguments.h" |
11 #include "src/base/bits.h" | 13 #include "src/base/bits.h" |
12 #include "src/codegen.h" | 14 #include "src/codegen.h" |
13 #include "src/conversions.h" | 15 #include "src/conversions.h" |
14 #include "src/execution.h" | 16 #include "src/execution.h" |
15 #include "src/field-type.h" | 17 #include "src/field-type.h" |
16 #include "src/frames-inl.h" | 18 #include "src/frames-inl.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 if (AddressIsDeoptimizedCode()) return; | 94 if (AddressIsDeoptimizedCode()) return; |
93 DCHECK(UseVector()); | 95 DCHECK(UseVector()); |
94 State new_state = nexus()->StateFromFeedback(); | 96 State new_state = nexus()->StateFromFeedback(); |
95 TraceIC(type, name, state(), new_state); | 97 TraceIC(type, name, state(), new_state); |
96 } | 98 } |
97 } | 99 } |
98 | 100 |
99 | 101 |
100 void IC::TraceIC(const char* type, Handle<Object> name, State old_state, | 102 void IC::TraceIC(const char* type, Handle<Object> name, State old_state, |
101 State new_state) { | 103 State new_state) { |
102 if (FLAG_trace_ic) { | 104 if (!FLAG_trace_ic) return; |
103 PrintF("[%s%s in ", is_keyed() ? "Keyed" : "", type); | 105 PrintF("[%s%s in ", is_keyed() ? "Keyed" : "", type); |
104 | 106 |
105 // TODO(jkummerow): Add support for "apply". The logic is roughly: | 107 // TODO(jkummerow): Add support for "apply". The logic is roughly: |
106 // marker = [fp_ + kMarkerOffset]; | 108 // marker = [fp_ + kMarkerOffset]; |
107 // if marker is smi and marker.value == INTERNAL and | 109 // if marker is smi and marker.value == INTERNAL and |
108 // the frame's code == builtin(Builtins::kFunctionApply): | 110 // the frame's code == builtin(Builtins::kFunctionApply): |
109 // then print "apply from" and advance one frame | 111 // then print "apply from" and advance one frame |
110 | 112 |
111 Object* maybe_function = | 113 Object* maybe_function = |
112 Memory::Object_at(fp_ + JavaScriptFrameConstants::kFunctionOffset); | 114 Memory::Object_at(fp_ + JavaScriptFrameConstants::kFunctionOffset); |
113 if (maybe_function->IsJSFunction()) { | 115 if (maybe_function->IsJSFunction()) { |
114 JSFunction* function = JSFunction::cast(maybe_function); | 116 JSFunction* function = JSFunction::cast(maybe_function); |
115 int code_offset = 0; | 117 int code_offset = 0; |
116 if (function->code()->is_interpreter_trampoline_builtin()) { | 118 if (function->code()->is_interpreter_trampoline_builtin()) { |
117 code_offset = InterpretedFrame::GetBytecodeOffset(fp()); | 119 code_offset = InterpretedFrame::GetBytecodeOffset(fp()); |
118 } else { | 120 } else { |
119 code_offset = | 121 code_offset = |
120 static_cast<int>(pc() - function->code()->instruction_start()); | 122 static_cast<int>(pc() - function->code()->instruction_start()); |
121 } | |
122 JavaScriptFrame::PrintFunctionAndOffset( | |
123 function, function->abstract_code(), code_offset, stdout, true); | |
124 } | 123 } |
| 124 JavaScriptFrame::PrintFunctionAndOffset(function, function->abstract_code(), |
| 125 code_offset, stdout, true); |
| 126 } |
125 | 127 |
126 const char* modifier = ""; | 128 const char* modifier = ""; |
127 if (kind() == Code::KEYED_STORE_IC) { | 129 if (kind() == Code::KEYED_STORE_IC) { |
128 KeyedAccessStoreMode mode = | 130 KeyedAccessStoreMode mode = |
129 casted_nexus<KeyedStoreICNexus>()->GetKeyedAccessStoreMode(); | 131 casted_nexus<KeyedStoreICNexus>()->GetKeyedAccessStoreMode(); |
130 modifier = GetTransitionMarkModifier(mode); | 132 modifier = GetTransitionMarkModifier(mode); |
131 } | |
132 void* map = nullptr; | |
133 if (!receiver_map().is_null()) { | |
134 map = reinterpret_cast<void*>(*receiver_map()); | |
135 } | |
136 PrintF(" (%c->%c%s) map=%p ", TransitionMarkFromState(old_state), | |
137 TransitionMarkFromState(new_state), modifier, map); | |
138 name->ShortPrint(stdout); | |
139 PrintF("]\n"); | |
140 } | 133 } |
| 134 Map* map = nullptr; |
| 135 if (!receiver_map().is_null()) { |
| 136 map = *receiver_map(); |
| 137 } |
| 138 PrintF(" (%c->%c%s) map=(%p", TransitionMarkFromState(old_state), |
| 139 TransitionMarkFromState(new_state), modifier, |
| 140 reinterpret_cast<void*>(map)); |
| 141 if (map != nullptr) { |
| 142 PrintF(" dict=%u own=%u type=", map->is_dictionary_map(), |
| 143 map->NumberOfOwnDescriptors()); |
| 144 std::cout << map->instance_type(); |
| 145 } |
| 146 PrintF(") "); |
| 147 name->ShortPrint(stdout); |
| 148 PrintF("]\n"); |
141 } | 149 } |
142 | 150 |
143 | 151 |
144 #define TRACE_IC(type, name) TraceIC(type, name) | 152 #define TRACE_IC(type, name) TraceIC(type, name) |
145 | 153 |
146 | 154 |
147 IC::IC(FrameDepth depth, Isolate* isolate, FeedbackNexus* nexus) | 155 IC::IC(FrameDepth depth, Isolate* isolate, FeedbackNexus* nexus) |
148 : isolate_(isolate), | 156 : isolate_(isolate), |
149 vector_set_(false), | 157 vector_set_(false), |
150 target_maps_set_(false), | 158 target_maps_set_(false), |
(...skipping 2862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3013 DCHECK_EQ(LookupIterator::INTERCEPTOR, it.state()); | 3021 DCHECK_EQ(LookupIterator::INTERCEPTOR, it.state()); |
3014 it.Next(); | 3022 it.Next(); |
3015 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, | 3023 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, |
3016 Object::GetProperty(&it)); | 3024 Object::GetProperty(&it)); |
3017 } | 3025 } |
3018 | 3026 |
3019 return *result; | 3027 return *result; |
3020 } | 3028 } |
3021 } // namespace internal | 3029 } // namespace internal |
3022 } // namespace v8 | 3030 } // namespace v8 |
OLD | NEW |