Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(332)

Side by Side Diff: src/type-feedback-vector.cc

Issue 893073006: Add map-based read barrier to WeakCell Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix merge Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/objects-printer.cc ('k') | src/type-info.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 Object* feedback = GetFeedback(); 386 Object* feedback = GetFeedback();
387 if (feedback->IsFixedArray()) { 387 if (feedback->IsFixedArray()) {
388 int found = 0; 388 int found = 0;
389 FixedArray* array = FixedArray::cast(feedback); 389 FixedArray* array = FixedArray::cast(feedback);
390 // The array should be of the form [<optional name>], then 390 // The array should be of the form [<optional name>], then
391 // [map, handler, map, handler, ... ] 391 // [map, handler, map, handler, ... ]
392 DCHECK(array->length() >= (2 + start_index)); 392 DCHECK(array->length() >= (2 + start_index));
393 for (int i = start_index; i < array->length(); i += 2) { 393 for (int i = start_index; i < array->length(); i += 2) {
394 WeakCell* cell = WeakCell::cast(array->get(i)); 394 WeakCell* cell = WeakCell::cast(array->get(i));
395 if (!cell->cleared()) { 395 if (!cell->cleared()) {
396 Map* map = Map::cast(cell->value()); 396 Map* map = Map::cast(cell->value(isolate->heap()));
397 maps->Add(handle(map, isolate)); 397 maps->Add(handle(map, isolate));
398 found++; 398 found++;
399 } 399 }
400 } 400 }
401 return found; 401 return found;
402 } 402 }
403 403
404 return 0; 404 return 0;
405 } 405 }
406 406
407 407
408 MaybeHandle<Code> FeedbackNexus::FindHandlerForMap(int start_index, 408 MaybeHandle<Code> FeedbackNexus::FindHandlerForMap(int start_index,
409 Handle<Map> map) const { 409 Handle<Map> map) const {
410 Object* feedback = GetFeedback(); 410 Object* feedback = GetFeedback();
411 if (feedback->IsFixedArray()) { 411 if (feedback->IsFixedArray()) {
412 FixedArray* array = FixedArray::cast(feedback); 412 FixedArray* array = FixedArray::cast(feedback);
413 for (int i = start_index; i < array->length(); i += 2) { 413 for (int i = start_index; i < array->length(); i += 2) {
414 WeakCell* cell = WeakCell::cast(array->get(i)); 414 WeakCell* cell = WeakCell::cast(array->get(i));
415 if (!cell->cleared()) { 415 if (!cell->cleared()) {
416 Map* array_map = Map::cast(cell->value()); 416 // Don't need a read barrier because we immediately
417 // discard the value unless we already had it from
418 // somewhere else.
419 Map* array_map = Map::cast(cell->ValueNoReadBarrier());
417 if (array_map == *map) { 420 if (array_map == *map) {
418 Code* code = Code::cast(array->get(i + 1)); 421 Code* code = Code::cast(array->get(i + 1));
419 DCHECK(code->kind() == Code::HANDLER); 422 DCHECK(code->kind() == Code::HANDLER);
420 return handle(code); 423 return handle(code);
421 } 424 }
422 } 425 }
423 } 426 }
424 } 427 }
425 428
426 return MaybeHandle<Code>(); 429 return MaybeHandle<Code>();
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 if (feedback->IsFixedArray()) { 498 if (feedback->IsFixedArray()) {
496 FixedArray* array = FixedArray::cast(feedback); 499 FixedArray* array = FixedArray::cast(feedback);
497 DCHECK(array->length() >= 3); 500 DCHECK(array->length() >= 3);
498 Object* name = array->get(0); 501 Object* name = array->get(0);
499 if (name->IsName()) return Name::cast(name); 502 if (name->IsName()) return Name::cast(name);
500 } 503 }
501 return NULL; 504 return NULL;
502 } 505 }
503 } 506 }
504 } // namespace v8::internal 507 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects-printer.cc ('k') | src/type-info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698