| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/ic/ic.h" | 7 #include "src/ic/ic.h" |
| 8 #include "src/ic/ic-state.h" | 8 #include "src/ic/ic-state.h" |
| 9 #include "src/objects.h" | 9 #include "src/objects.h" |
| 10 #include "src/type-feedback-vector-inl.h" | 10 #include "src/type-feedback-vector-inl.h" |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 Object* feedback = GetFeedback(); | 398 Object* feedback = GetFeedback(); |
| 399 if (feedback->IsFixedArray()) { | 399 if (feedback->IsFixedArray()) { |
| 400 int found = 0; | 400 int found = 0; |
| 401 FixedArray* array = FixedArray::cast(feedback); | 401 FixedArray* array = FixedArray::cast(feedback); |
| 402 // The array should be of the form [<optional name>], then | 402 // The array should be of the form [<optional name>], then |
| 403 // [map, handler, map, handler, ... ] | 403 // [map, handler, map, handler, ... ] |
| 404 DCHECK(array->length() >= (2 + start_index)); | 404 DCHECK(array->length() >= (2 + start_index)); |
| 405 for (int i = start_index; i < array->length(); i += 2) { | 405 for (int i = start_index; i < array->length(); i += 2) { |
| 406 WeakCell* cell = WeakCell::cast(array->get(i)); | 406 WeakCell* cell = WeakCell::cast(array->get(i)); |
| 407 if (!cell->cleared()) { | 407 if (!cell->cleared()) { |
| 408 Map* map = Map::cast(cell->value()); | 408 Map* map = Map::cast(cell->value(isolate->heap())); |
| 409 maps->Add(handle(map, isolate)); | 409 maps->Add(handle(map, isolate)); |
| 410 found++; | 410 found++; |
| 411 } | 411 } |
| 412 } | 412 } |
| 413 return found; | 413 return found; |
| 414 } | 414 } |
| 415 | 415 |
| 416 return 0; | 416 return 0; |
| 417 } | 417 } |
| 418 | 418 |
| 419 | 419 |
| 420 MaybeHandle<Code> FeedbackNexus::FindHandlerForMap(int start_index, | 420 MaybeHandle<Code> FeedbackNexus::FindHandlerForMap(int start_index, |
| 421 Handle<Map> map) const { | 421 Handle<Map> map) const { |
| 422 Object* feedback = GetFeedback(); | 422 Object* feedback = GetFeedback(); |
| 423 if (feedback->IsFixedArray()) { | 423 if (feedback->IsFixedArray()) { |
| 424 FixedArray* array = FixedArray::cast(feedback); | 424 FixedArray* array = FixedArray::cast(feedback); |
| 425 for (int i = start_index; i < array->length(); i += 2) { | 425 for (int i = start_index; i < array->length(); i += 2) { |
| 426 WeakCell* cell = WeakCell::cast(array->get(i)); | 426 WeakCell* cell = WeakCell::cast(array->get(i)); |
| 427 if (!cell->cleared()) { | 427 if (!cell->cleared()) { |
| 428 Map* array_map = Map::cast(cell->value()); | 428 // Don't need a read barrier because we immediately |
| 429 // discard the value unless we already had it from |
| 430 // somewhere else. |
| 431 Map* array_map = Map::cast(cell->ValueNoReadBarrier()); |
| 429 if (array_map == *map) { | 432 if (array_map == *map) { |
| 430 Code* code = Code::cast(array->get(i + 1)); | 433 Code* code = Code::cast(array->get(i + 1)); |
| 431 DCHECK(code->kind() == Code::HANDLER); | 434 DCHECK(code->kind() == Code::HANDLER); |
| 432 return handle(code); | 435 return handle(code); |
| 433 } | 436 } |
| 434 } | 437 } |
| 435 } | 438 } |
| 436 } | 439 } |
| 437 | 440 |
| 438 return MaybeHandle<Code>(); | 441 return MaybeHandle<Code>(); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 if (feedback->IsFixedArray()) { | 510 if (feedback->IsFixedArray()) { |
| 508 FixedArray* array = FixedArray::cast(feedback); | 511 FixedArray* array = FixedArray::cast(feedback); |
| 509 DCHECK(array->length() >= 3); | 512 DCHECK(array->length() >= 3); |
| 510 Object* name = array->get(0); | 513 Object* name = array->get(0); |
| 511 if (name->IsName()) return Name::cast(name); | 514 if (name->IsName()) return Name::cast(name); |
| 512 } | 515 } |
| 513 return NULL; | 516 return NULL; |
| 514 } | 517 } |
| 515 } | 518 } |
| 516 } // namespace v8::internal | 519 } // namespace v8::internal |
| OLD | NEW |