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

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

Issue 886663004: Revert of Use a WeakCell in the CallIC type vector. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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());
67 Object* obj = feedback_vector_->Get(slot); 65 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
77 if (!obj->IsJSFunction() || 66 if (!obj->IsJSFunction() ||
78 !CanRetainOtherContext(JSFunction::cast(obj), *native_context_)) { 67 !CanRetainOtherContext(JSFunction::cast(obj), *native_context_)) {
79 return Handle<Object>(obj, isolate()); 68 return Handle<Object>(obj, isolate());
80 } 69 }
81 return undefined; 70 return Handle<Object>::cast(isolate()->factory()->undefined_value());
82 } 71 }
83 72
84 73
85 bool TypeFeedbackOracle::LoadIsUninitialized(TypeFeedbackId id) { 74 bool TypeFeedbackOracle::LoadIsUninitialized(TypeFeedbackId id) {
86 Handle<Object> maybe_code = GetInfo(id); 75 Handle<Object> maybe_code = GetInfo(id);
87 if (maybe_code->IsCode()) { 76 if (maybe_code->IsCode()) {
88 Handle<Code> code = Handle<Code>::cast(maybe_code); 77 Handle<Code> code = Handle<Code>::cast(maybe_code);
89 return code->is_inline_cache_stub() && code->ic_state() == UNINITIALIZED; 78 return code->is_inline_cache_stub() && code->ic_state() == UNINITIALIZED;
90 } 79 }
91 return false; 80 return false;
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 UnseededNumberDictionary::kNotFound); 551 UnseededNumberDictionary::kNotFound);
563 // Dictionary has been allocated with sufficient size for all elements. 552 // Dictionary has been allocated with sufficient size for all elements.
564 DisallowHeapAllocation no_need_to_resize_dictionary; 553 DisallowHeapAllocation no_need_to_resize_dictionary;
565 HandleScope scope(isolate()); 554 HandleScope scope(isolate());
566 USE(UnseededNumberDictionary::AtNumberPut( 555 USE(UnseededNumberDictionary::AtNumberPut(
567 dictionary_, IdToKey(ast_id), handle(target, isolate()))); 556 dictionary_, IdToKey(ast_id), handle(target, isolate())));
568 } 557 }
569 558
570 559
571 } } // namespace v8::internal 560 } } // 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