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

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

Issue 2302283002: Forking the type system between Crankshaft & Turbofan. (Closed)
Patch Set: Nits. Created 4 years, 3 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-info.h ('k') | src/types.h » ('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/type-info.h" 5 #include "src/type-info.h"
6 6
7 #include "src/ast/ast.h" 7 #include "src/ast/ast.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/ic/ic.h" 9 #include "src/ic/ic.h"
10 #include "src/ic/stub-cache.h" 10 #include "src/ic/stub-cache.h"
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 184
185 Handle<AllocationSite> TypeFeedbackOracle::GetCallNewAllocationSite( 185 Handle<AllocationSite> TypeFeedbackOracle::GetCallNewAllocationSite(
186 FeedbackVectorSlot slot) { 186 FeedbackVectorSlot slot) {
187 Handle<Object> info = GetInfo(slot); 187 Handle<Object> info = GetInfo(slot);
188 if (info->IsAllocationSite()) { 188 if (info->IsAllocationSite()) {
189 return Handle<AllocationSite>::cast(info); 189 return Handle<AllocationSite>::cast(info);
190 } 190 }
191 return Handle<AllocationSite>::null(); 191 return Handle<AllocationSite>::null();
192 } 192 }
193 193
194 194 void TypeFeedbackOracle::CompareType(TypeFeedbackId id, AstType** left_type,
195 void TypeFeedbackOracle::CompareType(TypeFeedbackId id, 195 AstType** right_type,
196 Type** left_type, 196 AstType** combined_type) {
197 Type** right_type,
198 Type** combined_type) {
199 Handle<Object> info = GetInfo(id); 197 Handle<Object> info = GetInfo(id);
200 if (!info->IsCode()) { 198 if (!info->IsCode()) {
201 // For some comparisons we don't have ICs, e.g. LiteralCompareTypeof. 199 // For some comparisons we don't have ICs, e.g. LiteralCompareTypeof.
202 *left_type = *right_type = *combined_type = Type::None(); 200 *left_type = *right_type = *combined_type = AstType::None();
203 return; 201 return;
204 } 202 }
205 Handle<Code> code = Handle<Code>::cast(info); 203 Handle<Code> code = Handle<Code>::cast(info);
206 204
207 Handle<Map> map; 205 Handle<Map> map;
208 Map* raw_map = code->FindFirstMap(); 206 Map* raw_map = code->FindFirstMap();
209 if (raw_map != NULL) Map::TryUpdate(handle(raw_map)).ToHandle(&map); 207 if (raw_map != NULL) Map::TryUpdate(handle(raw_map)).ToHandle(&map);
210 208
211 if (code->is_compare_ic_stub()) { 209 if (code->is_compare_ic_stub()) {
212 CompareICStub stub(code->stub_key(), isolate()); 210 CompareICStub stub(code->stub_key(), isolate());
213 *left_type = CompareICState::StateToType(zone(), stub.left()); 211 *left_type = CompareICState::StateToType(zone(), stub.left());
214 *right_type = CompareICState::StateToType(zone(), stub.right()); 212 *right_type = CompareICState::StateToType(zone(), stub.right());
215 *combined_type = CompareICState::StateToType(zone(), stub.state(), map); 213 *combined_type = CompareICState::StateToType(zone(), stub.state(), map);
216 } 214 }
217 } 215 }
218 216
219 217 void TypeFeedbackOracle::BinaryType(TypeFeedbackId id, AstType** left,
220 void TypeFeedbackOracle::BinaryType(TypeFeedbackId id, 218 AstType** right, AstType** result,
221 Type** left,
222 Type** right,
223 Type** result,
224 Maybe<int>* fixed_right_arg, 219 Maybe<int>* fixed_right_arg,
225 Handle<AllocationSite>* allocation_site, 220 Handle<AllocationSite>* allocation_site,
226 Token::Value op) { 221 Token::Value op) {
227 Handle<Object> object = GetInfo(id); 222 Handle<Object> object = GetInfo(id);
228 if (!object->IsCode()) { 223 if (!object->IsCode()) {
229 // For some binary ops we don't have ICs, e.g. Token::COMMA, but for the 224 // For some binary ops we don't have ICs, e.g. Token::COMMA, but for the
230 // operations covered by the BinaryOpIC we should always have them. 225 // operations covered by the BinaryOpIC we should always have them.
231 DCHECK(op < BinaryOpICState::FIRST_TOKEN || 226 DCHECK(op < BinaryOpICState::FIRST_TOKEN ||
232 op > BinaryOpICState::LAST_TOKEN); 227 op > BinaryOpICState::LAST_TOKEN);
233 *left = *right = *result = Type::None(); 228 *left = *right = *result = AstType::None();
234 *fixed_right_arg = Nothing<int>(); 229 *fixed_right_arg = Nothing<int>();
235 *allocation_site = Handle<AllocationSite>::null(); 230 *allocation_site = Handle<AllocationSite>::null();
236 return; 231 return;
237 } 232 }
238 Handle<Code> code = Handle<Code>::cast(object); 233 Handle<Code> code = Handle<Code>::cast(object);
239 DCHECK_EQ(Code::BINARY_OP_IC, code->kind()); 234 DCHECK_EQ(Code::BINARY_OP_IC, code->kind());
240 BinaryOpICState state(isolate(), code->extra_ic_state()); 235 BinaryOpICState state(isolate(), code->extra_ic_state());
241 DCHECK_EQ(op, state.op()); 236 DCHECK_EQ(op, state.op());
242 237
243 *left = state.GetLeftType(); 238 *left = state.GetLeftType();
244 *right = state.GetRightType(); 239 *right = state.GetRightType();
245 *result = state.GetResultType(); 240 *result = state.GetResultType();
246 *fixed_right_arg = state.fixed_right_arg(); 241 *fixed_right_arg = state.fixed_right_arg();
247 242
248 AllocationSite* first_allocation_site = code->FindFirstAllocationSite(); 243 AllocationSite* first_allocation_site = code->FindFirstAllocationSite();
249 if (first_allocation_site != NULL) { 244 if (first_allocation_site != NULL) {
250 *allocation_site = handle(first_allocation_site); 245 *allocation_site = handle(first_allocation_site);
251 } else { 246 } else {
252 *allocation_site = Handle<AllocationSite>::null(); 247 *allocation_site = Handle<AllocationSite>::null();
253 } 248 }
254 } 249 }
255 250
256 251 AstType* TypeFeedbackOracle::CountType(TypeFeedbackId id) {
257 Type* TypeFeedbackOracle::CountType(TypeFeedbackId id) {
258 Handle<Object> object = GetInfo(id); 252 Handle<Object> object = GetInfo(id);
259 if (!object->IsCode()) return Type::None(); 253 if (!object->IsCode()) return AstType::None();
260 Handle<Code> code = Handle<Code>::cast(object); 254 Handle<Code> code = Handle<Code>::cast(object);
261 DCHECK_EQ(Code::BINARY_OP_IC, code->kind()); 255 DCHECK_EQ(Code::BINARY_OP_IC, code->kind());
262 BinaryOpICState state(isolate(), code->extra_ic_state()); 256 BinaryOpICState state(isolate(), code->extra_ic_state());
263 return state.GetLeftType(); 257 return state.GetLeftType();
264 } 258 }
265 259
266 260
267 bool TypeFeedbackOracle::HasOnlyStringMaps(SmallMapList* receiver_types) { 261 bool TypeFeedbackOracle::HasOnlyStringMaps(SmallMapList* receiver_types) {
268 bool all_strings = receiver_types->length() > 0; 262 bool all_strings = receiver_types->length() > 0;
269 for (int i = 0; i < receiver_types->length(); i++) { 263 for (int i = 0; i < receiver_types->length(); i++) {
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 // Dictionary has been allocated with sufficient size for all elements. 458 // Dictionary has been allocated with sufficient size for all elements.
465 DisallowHeapAllocation no_need_to_resize_dictionary; 459 DisallowHeapAllocation no_need_to_resize_dictionary;
466 HandleScope scope(isolate()); 460 HandleScope scope(isolate());
467 USE(UnseededNumberDictionary::AtNumberPut( 461 USE(UnseededNumberDictionary::AtNumberPut(
468 dictionary_, IdToKey(ast_id), handle(target, isolate()))); 462 dictionary_, IdToKey(ast_id), handle(target, isolate())));
469 } 463 }
470 464
471 465
472 } // namespace internal 466 } // namespace internal
473 } // namespace v8 467 } // namespace v8
OLDNEW
« no previous file with comments | « src/type-info.h ('k') | src/types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698