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 15735005: Collect type feedback for power-of-2 right operands in BinaryOps. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased Created 7 years, 6 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/type-info.h ('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 // 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 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 case BinaryOpIC::GENERIC: return TypeInfo::Unknown(); 449 case BinaryOpIC::GENERIC: return TypeInfo::Unknown();
450 } 450 }
451 UNREACHABLE(); 451 UNREACHABLE();
452 return TypeInfo::Unknown(); 452 return TypeInfo::Unknown();
453 } 453 }
454 454
455 455
456 void TypeFeedbackOracle::BinaryType(BinaryOperation* expr, 456 void TypeFeedbackOracle::BinaryType(BinaryOperation* expr,
457 TypeInfo* left, 457 TypeInfo* left,
458 TypeInfo* right, 458 TypeInfo* right,
459 TypeInfo* result) { 459 TypeInfo* result,
460 bool* has_fixed_right_arg,
461 int* fixed_right_arg_value) {
460 Handle<Object> object = GetInfo(expr->BinaryOperationFeedbackId()); 462 Handle<Object> object = GetInfo(expr->BinaryOperationFeedbackId());
461 TypeInfo unknown = TypeInfo::Unknown(); 463 TypeInfo unknown = TypeInfo::Unknown();
462 if (!object->IsCode()) { 464 if (!object->IsCode()) {
463 *left = *right = *result = unknown; 465 *left = *right = *result = unknown;
464 return; 466 return;
465 } 467 }
466 Handle<Code> code = Handle<Code>::cast(object); 468 Handle<Code> code = Handle<Code>::cast(object);
467 if (code->is_binary_op_stub()) { 469 if (code->is_binary_op_stub()) {
470 int minor_key = code->stub_info();
468 BinaryOpIC::TypeInfo left_type, right_type, result_type; 471 BinaryOpIC::TypeInfo left_type, right_type, result_type;
469 BinaryOpStub::decode_types_from_minor_key(code->stub_info(), &left_type, 472 BinaryOpStub::decode_types_from_minor_key(
470 &right_type, &result_type); 473 minor_key, &left_type, &right_type, &result_type);
471 *left = TypeFromBinaryOpType(left_type); 474 *left = TypeFromBinaryOpType(left_type);
472 *right = TypeFromBinaryOpType(right_type); 475 *right = TypeFromBinaryOpType(right_type);
473 *result = TypeFromBinaryOpType(result_type); 476 *result = TypeFromBinaryOpType(result_type);
477 *has_fixed_right_arg =
478 BinaryOpStub::decode_has_fixed_right_arg_from_minor_key(minor_key);
479 *fixed_right_arg_value =
480 BinaryOpStub::decode_fixed_right_arg_value_from_minor_key(minor_key);
474 return; 481 return;
475 } 482 }
476 // Not a binary op stub. 483 // Not a binary op stub.
477 *left = *right = *result = unknown; 484 *left = *right = *result = unknown;
478 } 485 }
479 486
480 487
481 TypeInfo TypeFeedbackOracle::SwitchType(CaseClause* clause) { 488 TypeInfo TypeFeedbackOracle::SwitchType(CaseClause* clause) {
482 Handle<Object> object = GetInfo(clause->CompareId()); 489 Handle<Object> object = GetInfo(clause->CompareId());
483 TypeInfo unknown = TypeInfo::Unknown(); 490 TypeInfo unknown = TypeInfo::Unknown();
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 USE(maybe_result); 765 USE(maybe_result);
759 #ifdef DEBUG 766 #ifdef DEBUG
760 Object* result = NULL; 767 Object* result = NULL;
761 // Dictionary has been allocated with sufficient size for all elements. 768 // Dictionary has been allocated with sufficient size for all elements.
762 ASSERT(maybe_result->ToObject(&result)); 769 ASSERT(maybe_result->ToObject(&result));
763 ASSERT(*dictionary_ == result); 770 ASSERT(*dictionary_ == result);
764 #endif 771 #endif
765 } 772 }
766 773
767 } } // namespace v8::internal 774 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/type-info.h ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698