| 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/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/ast.h" | 7 #include "src/ast.h" |
| 8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
| 9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
| 10 #include "src/ic/ic.h" |
| 10 #include "src/ic/stub-cache.h" | 11 #include "src/ic/stub-cache.h" |
| 11 #include "src/macro-assembler.h" | 12 #include "src/macro-assembler.h" |
| 12 #include "src/type-info.h" | 13 #include "src/type-info.h" |
| 13 | 14 |
| 14 #include "src/objects-inl.h" | 15 #include "src/objects-inl.h" |
| 15 | 16 |
| 16 namespace v8 { | 17 namespace v8 { |
| 17 namespace internal { | 18 namespace internal { |
| 18 | 19 |
| 19 | 20 |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 Map* raw_map = code->FindFirstMap(); | 190 Map* raw_map = code->FindFirstMap(); |
| 190 if (raw_map != NULL) { | 191 if (raw_map != NULL) { |
| 191 if (Map::TryUpdate(handle(raw_map)).ToHandle(&map) && | 192 if (Map::TryUpdate(handle(raw_map)).ToHandle(&map) && |
| 192 CanRetainOtherContext(*map, *native_context_)) { | 193 CanRetainOtherContext(*map, *native_context_)) { |
| 193 map = Handle<Map>::null(); | 194 map = Handle<Map>::null(); |
| 194 } | 195 } |
| 195 } | 196 } |
| 196 | 197 |
| 197 if (code->is_compare_ic_stub()) { | 198 if (code->is_compare_ic_stub()) { |
| 198 CompareICStub stub(code->stub_key(), isolate()); | 199 CompareICStub stub(code->stub_key(), isolate()); |
| 199 *left_type = CompareIC::StateToType(zone(), stub.left()); | 200 *left_type = CompareICState::StateToType(zone(), stub.left()); |
| 200 *right_type = CompareIC::StateToType(zone(), stub.right()); | 201 *right_type = CompareICState::StateToType(zone(), stub.right()); |
| 201 *combined_type = CompareIC::StateToType(zone(), stub.state(), map); | 202 *combined_type = CompareICState::StateToType(zone(), stub.state(), map); |
| 202 } else if (code->is_compare_nil_ic_stub()) { | 203 } else if (code->is_compare_nil_ic_stub()) { |
| 203 CompareNilICStub stub(isolate(), code->extra_ic_state()); | 204 CompareNilICStub stub(isolate(), code->extra_ic_state()); |
| 204 *combined_type = stub.GetType(zone(), map); | 205 *combined_type = stub.GetType(zone(), map); |
| 205 *left_type = *right_type = stub.GetInputType(zone(), map); | 206 *left_type = *right_type = stub.GetInputType(zone(), map); |
| 206 } | 207 } |
| 207 } | 208 } |
| 208 | 209 |
| 209 | 210 |
| 210 void TypeFeedbackOracle::BinaryType(TypeFeedbackId id, | 211 void TypeFeedbackOracle::BinaryType(TypeFeedbackId id, |
| 211 Type** left, | 212 Type** left, |
| 212 Type** right, | 213 Type** right, |
| 213 Type** result, | 214 Type** result, |
| 214 Maybe<int>* fixed_right_arg, | 215 Maybe<int>* fixed_right_arg, |
| 215 Handle<AllocationSite>* allocation_site, | 216 Handle<AllocationSite>* allocation_site, |
| 216 Token::Value op) { | 217 Token::Value op) { |
| 217 Handle<Object> object = GetInfo(id); | 218 Handle<Object> object = GetInfo(id); |
| 218 if (!object->IsCode()) { | 219 if (!object->IsCode()) { |
| 219 // For some binary ops we don't have ICs, e.g. Token::COMMA, but for the | 220 // For some binary ops we don't have ICs, e.g. Token::COMMA, but for the |
| 220 // operations covered by the BinaryOpIC we should always have them. | 221 // operations covered by the BinaryOpIC we should always have them. |
| 221 DCHECK(op < BinaryOpIC::State::FIRST_TOKEN || | 222 DCHECK(op < BinaryOpICState::FIRST_TOKEN || |
| 222 op > BinaryOpIC::State::LAST_TOKEN); | 223 op > BinaryOpICState::LAST_TOKEN); |
| 223 *left = *right = *result = Type::None(zone()); | 224 *left = *right = *result = Type::None(zone()); |
| 224 *fixed_right_arg = Maybe<int>(); | 225 *fixed_right_arg = Maybe<int>(); |
| 225 *allocation_site = Handle<AllocationSite>::null(); | 226 *allocation_site = Handle<AllocationSite>::null(); |
| 226 return; | 227 return; |
| 227 } | 228 } |
| 228 Handle<Code> code = Handle<Code>::cast(object); | 229 Handle<Code> code = Handle<Code>::cast(object); |
| 229 DCHECK_EQ(Code::BINARY_OP_IC, code->kind()); | 230 DCHECK_EQ(Code::BINARY_OP_IC, code->kind()); |
| 230 BinaryOpIC::State state(isolate(), code->extra_ic_state()); | 231 BinaryOpICState state(isolate(), code->extra_ic_state()); |
| 231 DCHECK_EQ(op, state.op()); | 232 DCHECK_EQ(op, state.op()); |
| 232 | 233 |
| 233 *left = state.GetLeftType(zone()); | 234 *left = state.GetLeftType(zone()); |
| 234 *right = state.GetRightType(zone()); | 235 *right = state.GetRightType(zone()); |
| 235 *result = state.GetResultType(zone()); | 236 *result = state.GetResultType(zone()); |
| 236 *fixed_right_arg = state.fixed_right_arg(); | 237 *fixed_right_arg = state.fixed_right_arg(); |
| 237 | 238 |
| 238 AllocationSite* first_allocation_site = code->FindFirstAllocationSite(); | 239 AllocationSite* first_allocation_site = code->FindFirstAllocationSite(); |
| 239 if (first_allocation_site != NULL) { | 240 if (first_allocation_site != NULL) { |
| 240 *allocation_site = handle(first_allocation_site); | 241 *allocation_site = handle(first_allocation_site); |
| 241 } else { | 242 } else { |
| 242 *allocation_site = Handle<AllocationSite>::null(); | 243 *allocation_site = Handle<AllocationSite>::null(); |
| 243 } | 244 } |
| 244 } | 245 } |
| 245 | 246 |
| 246 | 247 |
| 247 Type* TypeFeedbackOracle::CountType(TypeFeedbackId id) { | 248 Type* TypeFeedbackOracle::CountType(TypeFeedbackId id) { |
| 248 Handle<Object> object = GetInfo(id); | 249 Handle<Object> object = GetInfo(id); |
| 249 if (!object->IsCode()) return Type::None(zone()); | 250 if (!object->IsCode()) return Type::None(zone()); |
| 250 Handle<Code> code = Handle<Code>::cast(object); | 251 Handle<Code> code = Handle<Code>::cast(object); |
| 251 DCHECK_EQ(Code::BINARY_OP_IC, code->kind()); | 252 DCHECK_EQ(Code::BINARY_OP_IC, code->kind()); |
| 252 BinaryOpIC::State state(isolate(), code->extra_ic_state()); | 253 BinaryOpICState state(isolate(), code->extra_ic_state()); |
| 253 return state.GetLeftType(zone()); | 254 return state.GetLeftType(zone()); |
| 254 } | 255 } |
| 255 | 256 |
| 256 | 257 |
| 257 void TypeFeedbackOracle::PropertyReceiverTypes(TypeFeedbackId id, | 258 void TypeFeedbackOracle::PropertyReceiverTypes(TypeFeedbackId id, |
| 258 Handle<String> name, | 259 Handle<String> name, |
| 259 SmallMapList* receiver_types) { | 260 SmallMapList* receiver_types) { |
| 260 receiver_types->Clear(); | 261 receiver_types->Clear(); |
| 261 Code::Flags flags = Code::ComputeHandlerFlags(Code::LOAD_IC); | 262 Code::Flags flags = Code::ComputeHandlerFlags(Code::LOAD_IC); |
| 262 CollectReceiverTypes(id, name, flags, receiver_types); | 263 CollectReceiverTypes(id, name, flags, receiver_types); |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 UnseededNumberDictionary::kNotFound); | 462 UnseededNumberDictionary::kNotFound); |
| 462 // Dictionary has been allocated with sufficient size for all elements. | 463 // Dictionary has been allocated with sufficient size for all elements. |
| 463 DisallowHeapAllocation no_need_to_resize_dictionary; | 464 DisallowHeapAllocation no_need_to_resize_dictionary; |
| 464 HandleScope scope(isolate()); | 465 HandleScope scope(isolate()); |
| 465 USE(UnseededNumberDictionary::AtNumberPut( | 466 USE(UnseededNumberDictionary::AtNumberPut( |
| 466 dictionary_, IdToKey(ast_id), handle(target, isolate()))); | 467 dictionary_, IdToKey(ast_id), handle(target, isolate()))); |
| 467 } | 468 } |
| 468 | 469 |
| 469 | 470 |
| 470 } } // namespace v8::internal | 471 } } // namespace v8::internal |
| OLD | NEW |