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

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

Issue 107933005: Templatise type representation (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years 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
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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 } 370 }
371 371
372 372
373 void TypeFeedbackOracle::CompareType(TypeFeedbackId id, 373 void TypeFeedbackOracle::CompareType(TypeFeedbackId id,
374 Handle<Type>* left_type, 374 Handle<Type>* left_type,
375 Handle<Type>* right_type, 375 Handle<Type>* right_type,
376 Handle<Type>* combined_type) { 376 Handle<Type>* combined_type) {
377 Handle<Object> info = GetInfo(id); 377 Handle<Object> info = GetInfo(id);
378 if (!info->IsCode()) { 378 if (!info->IsCode()) {
379 // For some comparisons we don't have ICs, e.g. LiteralCompareTypeof. 379 // For some comparisons we don't have ICs, e.g. LiteralCompareTypeof.
380 *left_type = *right_type = *combined_type = handle(Type::None(), isolate_); 380 *left_type = *right_type = *combined_type = Type::None(isolate_);
381 return; 381 return;
382 } 382 }
383 Handle<Code> code = Handle<Code>::cast(info); 383 Handle<Code> code = Handle<Code>::cast(info);
384 384
385 Handle<Map> map; 385 Handle<Map> map;
386 Map* raw_map = code->FindFirstMap(); 386 Map* raw_map = code->FindFirstMap();
387 if (raw_map != NULL) { 387 if (raw_map != NULL) {
388 raw_map = raw_map->CurrentMapForDeprecated(); 388 raw_map = raw_map->CurrentMapForDeprecated();
389 if (raw_map != NULL && !CanRetainOtherContext(raw_map, *native_context_)) { 389 if (raw_map != NULL && !CanRetainOtherContext(raw_map, *native_context_)) {
390 map = handle(raw_map, isolate_); 390 map = handle(raw_map, isolate_);
(...skipping 17 matching lines...) Expand all
408 Handle<Type>* right, 408 Handle<Type>* right,
409 Handle<Type>* result, 409 Handle<Type>* result,
410 Maybe<int>* fixed_right_arg, 410 Maybe<int>* fixed_right_arg,
411 Token::Value op) { 411 Token::Value op) {
412 Handle<Object> object = GetInfo(id); 412 Handle<Object> object = GetInfo(id);
413 if (!object->IsCode()) { 413 if (!object->IsCode()) {
414 // For some binary ops we don't have ICs, e.g. Token::COMMA, but for the 414 // For some binary ops we don't have ICs, e.g. Token::COMMA, but for the
415 // operations covered by the BinaryOpIC we should always have them. 415 // operations covered by the BinaryOpIC we should always have them.
416 ASSERT(op < BinaryOpIC::State::FIRST_TOKEN || 416 ASSERT(op < BinaryOpIC::State::FIRST_TOKEN ||
417 op > BinaryOpIC::State::LAST_TOKEN); 417 op > BinaryOpIC::State::LAST_TOKEN);
418 *left = *right = *result = handle(Type::None(), isolate_); 418 *left = *right = *result = Type::None(isolate_);
419 *fixed_right_arg = Maybe<int>(); 419 *fixed_right_arg = Maybe<int>();
420 return; 420 return;
421 } 421 }
422 Handle<Code> code = Handle<Code>::cast(object); 422 Handle<Code> code = Handle<Code>::cast(object);
423 ASSERT_EQ(Code::BINARY_OP_IC, code->kind()); 423 ASSERT_EQ(Code::BINARY_OP_IC, code->kind());
424 BinaryOpIC::State state(code->extended_extra_ic_state()); 424 BinaryOpIC::State state(code->extended_extra_ic_state());
425 ASSERT_EQ(op, state.op()); 425 ASSERT_EQ(op, state.op());
426 426
427 *left = state.GetLeftType(isolate()); 427 *left = state.GetLeftType(isolate());
428 *right = state.GetRightType(isolate()); 428 *right = state.GetRightType(isolate());
429 *result = state.GetResultType(isolate()); 429 *result = state.GetResultType(isolate());
430 *fixed_right_arg = state.fixed_right_arg(); 430 *fixed_right_arg = state.fixed_right_arg();
431 } 431 }
432 432
433 433
434 Handle<Type> TypeFeedbackOracle::ClauseType(TypeFeedbackId id) { 434 Handle<Type> TypeFeedbackOracle::ClauseType(TypeFeedbackId id) {
435 Handle<Object> info = GetInfo(id); 435 Handle<Object> info = GetInfo(id);
436 Handle<Type> result(Type::None(), isolate_); 436 Handle<Type> result = Type::None(isolate_);
437 if (info->IsCode() && Handle<Code>::cast(info)->is_compare_ic_stub()) { 437 if (info->IsCode() && Handle<Code>::cast(info)->is_compare_ic_stub()) {
438 Handle<Code> code = Handle<Code>::cast(info); 438 Handle<Code> code = Handle<Code>::cast(info);
439 CompareIC::State state = ICCompareStub::CompareState(code->stub_info()); 439 CompareIC::State state = ICCompareStub::CompareState(code->stub_info());
440 result = CompareIC::StateToType(isolate_, state); 440 result = CompareIC::StateToType(isolate_, state);
441 } 441 }
442 return result; 442 return result;
443 } 443 }
444 444
445 445
446 Handle<Type> TypeFeedbackOracle::CountType(TypeFeedbackId id) { 446 Handle<Type> TypeFeedbackOracle::CountType(TypeFeedbackId id) {
447 Handle<Object> object = GetInfo(id); 447 Handle<Object> object = GetInfo(id);
448 if (!object->IsCode()) return handle(Type::None(), isolate_); 448 if (!object->IsCode()) return Type::None(isolate_);
449 Handle<Code> code = Handle<Code>::cast(object); 449 Handle<Code> code = Handle<Code>::cast(object);
450 ASSERT_EQ(Code::BINARY_OP_IC, code->kind()); 450 ASSERT_EQ(Code::BINARY_OP_IC, code->kind());
451 BinaryOpIC::State state(code->extended_extra_ic_state()); 451 BinaryOpIC::State state(code->extended_extra_ic_state());
452 return state.GetLeftType(isolate()); 452 return state.GetLeftType(isolate());
453 } 453 }
454 454
455 455
456 void TypeFeedbackOracle::PropertyReceiverTypes( 456 void TypeFeedbackOracle::PropertyReceiverTypes(
457 TypeFeedbackId id, Handle<String> name, 457 TypeFeedbackId id, Handle<String> name,
458 SmallMapList* receiver_types, bool* is_prototype) { 458 SmallMapList* receiver_types, bool* is_prototype) {
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 if (info.IsUninitialized()) return Representation::None(); 756 if (info.IsUninitialized()) return Representation::None();
757 if (info.IsSmi()) return Representation::Smi(); 757 if (info.IsSmi()) return Representation::Smi();
758 if (info.IsInteger32()) return Representation::Integer32(); 758 if (info.IsInteger32()) return Representation::Integer32();
759 if (info.IsDouble()) return Representation::Double(); 759 if (info.IsDouble()) return Representation::Double();
760 if (info.IsNumber()) return Representation::Double(); 760 if (info.IsNumber()) return Representation::Double();
761 return Representation::Tagged(); 761 return Representation::Tagged();
762 } 762 }
763 763
764 764
765 } } // namespace v8::internal 765 } } // namespace v8::internal
OLDNEW
« src/property-details.h ('K') | « src/stub-cache.cc ('k') | src/types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698