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

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

Issue 148503002: A64: Synchronize with r15545. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « src/third_party/vtune/v8vtune.gyp ('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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 STANDARD_STORE); 179 STANDARD_STORE);
180 return code->is_keyed_store_stub() && standard_store && 180 return code->is_keyed_store_stub() && standard_store &&
181 code->ic_state() == POLYMORPHIC; 181 code->ic_state() == POLYMORPHIC;
182 } 182 }
183 return false; 183 return false;
184 } 184 }
185 185
186 186
187 bool TypeFeedbackOracle::CallIsMonomorphic(Call* expr) { 187 bool TypeFeedbackOracle::CallIsMonomorphic(Call* expr) {
188 Handle<Object> value = GetInfo(expr->CallFeedbackId()); 188 Handle<Object> value = GetInfo(expr->CallFeedbackId());
189 return value->IsMap() || value->IsSmi() || value->IsJSFunction(); 189 return value->IsMap() || value->IsAllocationSite() || value->IsJSFunction() ||
190 value->IsSmi();
190 } 191 }
191 192
192 193
193 bool TypeFeedbackOracle::CallNewIsMonomorphic(CallNew* expr) { 194 bool TypeFeedbackOracle::CallNewIsMonomorphic(CallNew* expr) {
194 Handle<Object> info = GetInfo(expr->CallNewFeedbackId()); 195 Handle<Object> info = GetInfo(expr->CallNewFeedbackId());
195 return info->IsSmi() || info->IsJSFunction(); 196 return info->IsAllocationSite() || info->IsJSFunction();
196 } 197 }
197 198
198 199
199 bool TypeFeedbackOracle::ObjectLiteralStoreIsMonomorphic( 200 bool TypeFeedbackOracle::ObjectLiteralStoreIsMonomorphic(
200 ObjectLiteral::Property* prop) { 201 ObjectLiteral::Property* prop) {
201 Handle<Object> map_or_code = GetInfo(prop->key()->LiteralFeedbackId()); 202 Handle<Object> map_or_code = GetInfo(prop->key()->LiteralFeedbackId());
202 return map_or_code->IsMap(); 203 return map_or_code->IsMap();
203 } 204 }
204 205
205 206
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 Handle<Object> value = GetInfo(expr->CallFeedbackId()); 296 Handle<Object> value = GetInfo(expr->CallFeedbackId());
296 if (!value->IsSmi()) return RECEIVER_MAP_CHECK; 297 if (!value->IsSmi()) return RECEIVER_MAP_CHECK;
297 CheckType check = static_cast<CheckType>(Smi::cast(*value)->value()); 298 CheckType check = static_cast<CheckType>(Smi::cast(*value)->value());
298 ASSERT(check != RECEIVER_MAP_CHECK); 299 ASSERT(check != RECEIVER_MAP_CHECK);
299 return check; 300 return check;
300 } 301 }
301 302
302 303
303 Handle<JSFunction> TypeFeedbackOracle::GetCallTarget(Call* expr) { 304 Handle<JSFunction> TypeFeedbackOracle::GetCallTarget(Call* expr) {
304 Handle<Object> info = GetInfo(expr->CallFeedbackId()); 305 Handle<Object> info = GetInfo(expr->CallFeedbackId());
305 if (info->IsSmi()) { 306 if (info->IsAllocationSite()) {
306 ASSERT(static_cast<ElementsKind>(Smi::cast(*info)->value()) <=
307 LAST_FAST_ELEMENTS_KIND);
308 return Handle<JSFunction>(isolate_->global_context()->array_function()); 307 return Handle<JSFunction>(isolate_->global_context()->array_function());
309 } else { 308 } else {
310 return Handle<JSFunction>::cast(info); 309 return Handle<JSFunction>::cast(info);
311 } 310 }
312 } 311 }
313 312
314 313
315 Handle<JSFunction> TypeFeedbackOracle::GetCallNewTarget(CallNew* expr) { 314 Handle<JSFunction> TypeFeedbackOracle::GetCallNewTarget(CallNew* expr) {
316 Handle<Object> info = GetInfo(expr->CallNewFeedbackId()); 315 Handle<Object> info = GetInfo(expr->CallNewFeedbackId());
317 if (info->IsSmi()) { 316 if (info->IsAllocationSite()) {
318 ASSERT(static_cast<ElementsKind>(Smi::cast(*info)->value()) <=
319 LAST_FAST_ELEMENTS_KIND);
320 return Handle<JSFunction>(isolate_->global_context()->array_function()); 317 return Handle<JSFunction>(isolate_->global_context()->array_function());
321 } else { 318 } else {
322 return Handle<JSFunction>::cast(info); 319 return Handle<JSFunction>::cast(info);
323 } 320 }
324 } 321 }
325 322
326 323
327 Handle<Cell> TypeFeedbackOracle::GetCallNewAllocationInfoCell(CallNew* expr) { 324 Handle<Cell> TypeFeedbackOracle::GetCallNewAllocationInfoCell(CallNew* expr) {
328 return GetInfoCell(expr->CallNewFeedbackId()); 325 return GetInfoCell(expr->CallNewFeedbackId());
329 } 326 }
(...skipping 19 matching lines...) Expand all
349 if (!code->is_load_stub()) return false; 346 if (!code->is_load_stub()) return false;
350 if (code->ic_state() != MONOMORPHIC) return false; 347 if (code->ic_state() != MONOMORPHIC) return false;
351 return stub->Describes(*code); 348 return stub->Describes(*code);
352 } 349 }
353 350
354 351
355 void TypeFeedbackOracle::CompareType(TypeFeedbackId id, 352 void TypeFeedbackOracle::CompareType(TypeFeedbackId id,
356 Handle<Type>* left_type, 353 Handle<Type>* left_type,
357 Handle<Type>* right_type, 354 Handle<Type>* right_type,
358 Handle<Type>* combined_type) { 355 Handle<Type>* combined_type) {
359 *left_type = *right_type = *combined_type = handle(Type::Any(), isolate_);
360 Handle<Object> info = GetInfo(id); 356 Handle<Object> info = GetInfo(id);
361 if (!info->IsCode()) return; 357 if (!info->IsCode()) {
358 // For some comparisons we don't have ICs, e.g. LiteralCompareTypeof.
359 *left_type = *right_type = *combined_type = handle(Type::None(), isolate_);
360 return;
361 }
362 Handle<Code> code = Handle<Code>::cast(info); 362 Handle<Code> code = Handle<Code>::cast(info);
363 363
364 Handle<Map> map; 364 Handle<Map> map;
365 Map* raw_map = code->FindFirstMap(); 365 Map* raw_map = code->FindFirstMap();
366 if (raw_map != NULL) { 366 if (raw_map != NULL) {
367 raw_map = raw_map->CurrentMapForDeprecated(); 367 raw_map = raw_map->CurrentMapForDeprecated();
368 if (raw_map != NULL && !CanRetainOtherContext(raw_map, *native_context_)) { 368 if (raw_map != NULL && !CanRetainOtherContext(raw_map, *native_context_)) {
369 map = handle(raw_map, isolate_); 369 map = handle(raw_map, isolate_);
370 } 370 }
371 } 371 }
372 372
373 if (code->is_compare_ic_stub()) { 373 if (code->is_compare_ic_stub()) {
374 int stub_minor_key = code->stub_info(); 374 int stub_minor_key = code->stub_info();
375 CompareIC::StubInfoToType( 375 CompareIC::StubInfoToType(
376 stub_minor_key, left_type, right_type, combined_type, map, isolate()); 376 stub_minor_key, left_type, right_type, combined_type, map, isolate());
377 } else if (code->is_compare_nil_ic_stub()) { 377 } else if (code->is_compare_nil_ic_stub()) {
378 CompareNilICStub::State state(code->compare_nil_state()); 378 CompareNilICStub::State state(code->compare_nil_state());
379 *combined_type = CompareNilICStub::StateToType(isolate_, state, map); 379 *combined_type = CompareNilICStub::StateToType(isolate_, state, map);
380 Handle<Type> nil_type = handle(code->compare_nil_value() == kNullValue 380 Handle<Type> nil_type = handle(code->compare_nil_value() == kNullValue
381 ? Type::Null() : Type::Undefined(), isolate_); 381 ? Type::Null() : Type::Undefined(), isolate_);
382 *left_type = *right_type = 382 *left_type = *right_type =
383 handle(Type::Union(*combined_type, nil_type), isolate_); 383 handle(Type::Union(*combined_type, nil_type), isolate_);
384 } 384 }
385 } 385 }
386 386
387 387
388 Handle<Type> TypeFeedbackOracle::UnaryType(TypeFeedbackId id) { 388 Handle<Type> TypeFeedbackOracle::UnaryType(TypeFeedbackId id) {
389 Handle<Object> object = GetInfo(id); 389 Handle<Object> object = GetInfo(id);
390 if (!object->IsCode()) return handle(Type::Any(), isolate()); 390 if (!object->IsCode()) {
391 return handle(Type::None(), isolate());
392 }
391 Handle<Code> code = Handle<Code>::cast(object); 393 Handle<Code> code = Handle<Code>::cast(object);
392 ASSERT(code->is_unary_op_stub()); 394 ASSERT(code->is_unary_op_stub());
393 return UnaryOpIC::TypeInfoToType( 395 return UnaryOpStub(code->extra_ic_state()).GetType(isolate());
394 static_cast<UnaryOpIC::TypeInfo>(code->unary_op_type()), isolate());
395 } 396 }
396 397
397 398
398 void TypeFeedbackOracle::BinaryType(TypeFeedbackId id, 399 void TypeFeedbackOracle::BinaryType(TypeFeedbackId id,
399 Handle<Type>* left, 400 Handle<Type>* left,
400 Handle<Type>* right, 401 Handle<Type>* right,
401 Handle<Type>* result, 402 Handle<Type>* result,
402 Maybe<int>* fixed_right_arg) { 403 Maybe<int>* fixed_right_arg) {
403 Handle<Object> object = GetInfo(id); 404 Handle<Object> object = GetInfo(id);
404 *left = *right = *result = handle(Type::Any(), isolate_); 405 if (!object->IsCode()) {
405 if (!object->IsCode()) return; 406 // For some binary ops we don't have ICs, e.g. Token::COMMA.
407 *left = *right = *result = handle(Type::None(), isolate_);
408 return;
409 }
406 Handle<Code> code = Handle<Code>::cast(object); 410 Handle<Code> code = Handle<Code>::cast(object);
407 if (!code->is_binary_op_stub()) return; 411 ASSERT(code->is_binary_op_stub());
408 412
409 int minor_key = code->stub_info(); 413 int minor_key = code->stub_info();
410 BinaryOpIC::StubInfoToType(minor_key, left, right, result, isolate()); 414 BinaryOpIC::StubInfoToType(minor_key, left, right, result, isolate());
411 *fixed_right_arg = 415 *fixed_right_arg =
412 BinaryOpStub::decode_fixed_right_arg_from_minor_key(minor_key); 416 BinaryOpStub::decode_fixed_right_arg_from_minor_key(minor_key);
413 } 417 }
414 418
415 419
416 Handle<Type> TypeFeedbackOracle::ClauseType(TypeFeedbackId id) { 420 Handle<Type> TypeFeedbackOracle::ClauseType(TypeFeedbackId id) {
417 Handle<Object> info = GetInfo(id); 421 Handle<Object> info = GetInfo(id);
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 void TypeFeedbackOracle::ProcessTypeFeedbackCells(Handle<Code> code) { 665 void TypeFeedbackOracle::ProcessTypeFeedbackCells(Handle<Code> code) {
662 Object* raw_info = code->type_feedback_info(); 666 Object* raw_info = code->type_feedback_info();
663 if (!raw_info->IsTypeFeedbackInfo()) return; 667 if (!raw_info->IsTypeFeedbackInfo()) return;
664 Handle<TypeFeedbackCells> cache( 668 Handle<TypeFeedbackCells> cache(
665 TypeFeedbackInfo::cast(raw_info)->type_feedback_cells()); 669 TypeFeedbackInfo::cast(raw_info)->type_feedback_cells());
666 for (int i = 0; i < cache->CellCount(); i++) { 670 for (int i = 0; i < cache->CellCount(); i++) {
667 TypeFeedbackId ast_id = cache->AstId(i); 671 TypeFeedbackId ast_id = cache->AstId(i);
668 Cell* cell = cache->GetCell(i); 672 Cell* cell = cache->GetCell(i);
669 Object* value = cell->value(); 673 Object* value = cell->value();
670 if (value->IsSmi() || 674 if (value->IsSmi() ||
675 value->IsAllocationSite() ||
671 (value->IsJSFunction() && 676 (value->IsJSFunction() &&
672 !CanRetainOtherContext(JSFunction::cast(value), 677 !CanRetainOtherContext(JSFunction::cast(value),
673 *native_context_))) { 678 *native_context_))) {
674 SetInfo(ast_id, cell); 679 SetInfo(ast_id, cell);
675 } 680 }
676 } 681 }
677 } 682 }
678 683
679 684
680 void TypeFeedbackOracle::SetInfo(TypeFeedbackId ast_id, Object* target) { 685 void TypeFeedbackOracle::SetInfo(TypeFeedbackId ast_id, Object* target) {
681 ASSERT(dictionary_->FindEntry(IdToKey(ast_id)) == 686 ASSERT(dictionary_->FindEntry(IdToKey(ast_id)) ==
682 UnseededNumberDictionary::kNotFound); 687 UnseededNumberDictionary::kNotFound);
683 MaybeObject* maybe_result = dictionary_->AtNumberPut(IdToKey(ast_id), target); 688 MaybeObject* maybe_result = dictionary_->AtNumberPut(IdToKey(ast_id), target);
684 USE(maybe_result); 689 USE(maybe_result);
685 #ifdef DEBUG 690 #ifdef DEBUG
686 Object* result = NULL; 691 Object* result = NULL;
687 // Dictionary has been allocated with sufficient size for all elements. 692 // Dictionary has been allocated with sufficient size for all elements.
688 ASSERT(maybe_result->ToObject(&result)); 693 ASSERT(maybe_result->ToObject(&result));
689 ASSERT(*dictionary_ == result); 694 ASSERT(*dictionary_ == result);
690 #endif 695 #endif
691 } 696 }
692 697
698
699 Representation Representation::FromType(TypeInfo info) {
700 if (info.IsUninitialized()) return Representation::None();
701 // TODO(verwaest): Return Smi rather than Integer32.
702 if (info.IsSmi()) return Representation::Integer32();
703 if (info.IsInteger32()) return Representation::Integer32();
704 if (info.IsDouble()) return Representation::Double();
705 if (info.IsNumber()) return Representation::Double();
706 return Representation::Tagged();
707 }
708
709
693 } } // namespace v8::internal 710 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/third_party/vtune/v8vtune.gyp ('k') | src/types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698