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

Side by Side Diff: src/type-info.cc

Issue 866493003: Retry "Use a WeakCell in the CallIC type vector." (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE. 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/type-feedback-vector.cc ('k') | src/x64/code-stubs-x64.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 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/ic.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 if (!obj->IsJSFunction() || 55 if (!obj->IsJSFunction() ||
56 !CanRetainOtherContext(JSFunction::cast(obj), *native_context_)) { 56 !CanRetainOtherContext(JSFunction::cast(obj), *native_context_)) {
57 return Handle<Object>(obj, isolate()); 57 return Handle<Object>(obj, isolate());
58 } 58 }
59 return Handle<Object>::cast(isolate()->factory()->undefined_value()); 59 return Handle<Object>::cast(isolate()->factory()->undefined_value());
60 } 60 }
61 61
62 62
63 Handle<Object> TypeFeedbackOracle::GetInfo(FeedbackVectorICSlot slot) { 63 Handle<Object> TypeFeedbackOracle::GetInfo(FeedbackVectorICSlot slot) {
64 DCHECK(slot.ToInt() >= 0 && slot.ToInt() < feedback_vector_->length()); 64 DCHECK(slot.ToInt() >= 0 && slot.ToInt() < feedback_vector_->length());
65 Handle<Object> undefined =
66 Handle<Object>::cast(isolate()->factory()->undefined_value());
65 Object* obj = feedback_vector_->Get(slot); 67 Object* obj = feedback_vector_->Get(slot);
68
69 // Vector-based ICs do not embed direct pointers to maps, functions.
70 // Instead a WeakCell is always used.
71 if (obj->IsWeakCell()) {
72 WeakCell* cell = WeakCell::cast(obj);
73 if (cell->cleared()) return undefined;
74 obj = cell->value();
75 }
76
66 if (!obj->IsJSFunction() || 77 if (!obj->IsJSFunction() ||
67 !CanRetainOtherContext(JSFunction::cast(obj), *native_context_)) { 78 !CanRetainOtherContext(JSFunction::cast(obj), *native_context_)) {
68 return Handle<Object>(obj, isolate()); 79 return Handle<Object>(obj, isolate());
69 } 80 }
70 return Handle<Object>::cast(isolate()->factory()->undefined_value()); 81 return undefined;
71 } 82 }
72 83
73 84
74 bool TypeFeedbackOracle::LoadIsUninitialized(TypeFeedbackId id) { 85 bool TypeFeedbackOracle::LoadIsUninitialized(TypeFeedbackId id) {
75 Handle<Object> maybe_code = GetInfo(id); 86 Handle<Object> maybe_code = GetInfo(id);
76 if (maybe_code->IsCode()) { 87 if (maybe_code->IsCode()) {
77 Handle<Code> code = Handle<Code>::cast(maybe_code); 88 Handle<Code> code = Handle<Code>::cast(maybe_code);
78 return code->is_inline_cache_stub() && code->ic_state() == UNINITIALIZED; 89 return code->is_inline_cache_stub() && code->ic_state() == UNINITIALIZED;
79 } 90 }
80 return false; 91 return false;
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 UnseededNumberDictionary::kNotFound); 562 UnseededNumberDictionary::kNotFound);
552 // Dictionary has been allocated with sufficient size for all elements. 563 // Dictionary has been allocated with sufficient size for all elements.
553 DisallowHeapAllocation no_need_to_resize_dictionary; 564 DisallowHeapAllocation no_need_to_resize_dictionary;
554 HandleScope scope(isolate()); 565 HandleScope scope(isolate());
555 USE(UnseededNumberDictionary::AtNumberPut( 566 USE(UnseededNumberDictionary::AtNumberPut(
556 dictionary_, IdToKey(ast_id), handle(target, isolate()))); 567 dictionary_, IdToKey(ast_id), handle(target, isolate())));
557 } 568 }
558 569
559 570
560 } } // namespace v8::internal 571 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/type-feedback-vector.cc ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698