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

Side by Side Diff: src/ic.cc

Issue 142813003: A64: Synchronize with r15358. (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/ia32/macro-assembler-ia32.cc ('k') | src/isolate.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 2419 matching lines...) Expand 10 before | Expand all | Expand 10 after
2430 UNREACHABLE(); 2430 UNREACHABLE();
2431 return v8::internal::UNINITIALIZED; 2431 return v8::internal::UNINITIALIZED;
2432 } 2432 }
2433 2433
2434 2434
2435 Handle<Type> UnaryOpIC::TypeInfoToType(TypeInfo type_info, Isolate* isolate) { 2435 Handle<Type> UnaryOpIC::TypeInfoToType(TypeInfo type_info, Isolate* isolate) {
2436 switch (type_info) { 2436 switch (type_info) {
2437 case UNINITIALIZED: 2437 case UNINITIALIZED:
2438 return handle(Type::None(), isolate); 2438 return handle(Type::None(), isolate);
2439 case SMI: 2439 case SMI:
2440 return handle(Type::Integer31(), isolate); 2440 return handle(Type::Smi(), isolate);
2441 case NUMBER: 2441 case NUMBER:
2442 return handle(Type::Number(), isolate); 2442 return handle(Type::Number(), isolate);
2443 case GENERIC: 2443 case GENERIC:
2444 return handle(Type::Any(), isolate); 2444 return handle(Type::Any(), isolate);
2445 } 2445 }
2446 UNREACHABLE(); 2446 UNREACHABLE();
2447 return handle(Type::Any(), isolate); 2447 return handle(Type::Any(), isolate);
2448 } 2448 }
2449 2449
2450 2450
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
2517 return ::v8::internal::UNINITIALIZED; 2517 return ::v8::internal::UNINITIALIZED;
2518 } 2518 }
2519 2519
2520 2520
2521 Handle<Type> BinaryOpIC::TypeInfoToType(BinaryOpIC::TypeInfo binary_type, 2521 Handle<Type> BinaryOpIC::TypeInfoToType(BinaryOpIC::TypeInfo binary_type,
2522 Isolate* isolate) { 2522 Isolate* isolate) {
2523 switch (binary_type) { 2523 switch (binary_type) {
2524 case UNINITIALIZED: 2524 case UNINITIALIZED:
2525 return handle(Type::None(), isolate); 2525 return handle(Type::None(), isolate);
2526 case SMI: 2526 case SMI:
2527 return handle(Type::Integer31(), isolate); 2527 return handle(Type::Smi(), isolate);
2528 case INT32: 2528 case INT32:
2529 return handle(Type::Integer32(), isolate); 2529 return handle(Type::Signed32(), isolate);
2530 case NUMBER: 2530 case NUMBER:
2531 return handle(Type::Number(), isolate); 2531 return handle(Type::Number(), isolate);
2532 case ODDBALL: 2532 case ODDBALL:
2533 return handle(Type::Optional( 2533 return handle(Type::Optional(
2534 handle(Type::Union( 2534 handle(Type::Union(
2535 handle(Type::Number(), isolate), 2535 handle(Type::Number(), isolate),
2536 handle(Type::String(), isolate)), isolate)), isolate); 2536 handle(Type::String(), isolate)), isolate)), isolate);
2537 case STRING: 2537 case STRING:
2538 return handle(Type::String(), isolate); 2538 return handle(Type::String(), isolate);
2539 case GENERIC: 2539 case GENERIC:
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
2646 if (new_type == BinaryOpIC::STRING) return new_type; 2646 if (new_type == BinaryOpIC::STRING) return new_type;
2647 return BinaryOpIC::GENERIC; 2647 return BinaryOpIC::GENERIC;
2648 } 2648 }
2649 return Max(old_type, new_type); 2649 return Max(old_type, new_type);
2650 } 2650 }
2651 2651
2652 2652
2653 #ifdef DEBUG 2653 #ifdef DEBUG
2654 static void TraceBinaryOp(BinaryOpIC::TypeInfo left, 2654 static void TraceBinaryOp(BinaryOpIC::TypeInfo left,
2655 BinaryOpIC::TypeInfo right, 2655 BinaryOpIC::TypeInfo right,
2656 bool has_fixed_right_arg, 2656 Maybe<int32_t> fixed_right_arg,
2657 int32_t fixed_right_arg_value,
2658 BinaryOpIC::TypeInfo result) { 2657 BinaryOpIC::TypeInfo result) {
2659 PrintF("%s*%s", BinaryOpIC::GetName(left), BinaryOpIC::GetName(right)); 2658 PrintF("%s*%s", BinaryOpIC::GetName(left), BinaryOpIC::GetName(right));
2660 if (has_fixed_right_arg) PrintF("{%d}", fixed_right_arg_value); 2659 if (fixed_right_arg.has_value) PrintF("{%d}", fixed_right_arg.value);
2661 PrintF("->%s", BinaryOpIC::GetName(result)); 2660 PrintF("->%s", BinaryOpIC::GetName(result));
2662 } 2661 }
2663 #endif 2662 #endif
2664 2663
2665 2664
2666 RUNTIME_FUNCTION(MaybeObject*, BinaryOp_Patch) { 2665 RUNTIME_FUNCTION(MaybeObject*, BinaryOp_Patch) {
2667 ASSERT(args.length() == 3); 2666 ASSERT(args.length() == 3);
2668 2667
2669 HandleScope scope(isolate); 2668 HandleScope scope(isolate);
2670 Handle<Object> left = args.at<Object>(0); 2669 Handle<Object> left = args.at<Object>(0);
(...skipping 11 matching lines...) Expand all
2682 2681
2683 // STRING is only used for ADD operations. 2682 // STRING is only used for ADD operations.
2684 if ((new_left == BinaryOpIC::STRING || new_right == BinaryOpIC::STRING) && 2683 if ((new_left == BinaryOpIC::STRING || new_right == BinaryOpIC::STRING) &&
2685 op != Token::ADD) { 2684 op != Token::ADD) {
2686 new_left = new_right = BinaryOpIC::GENERIC; 2685 new_left = new_right = BinaryOpIC::GENERIC;
2687 } 2686 }
2688 2687
2689 BinaryOpIC::TypeInfo new_overall = Max(new_left, new_right); 2688 BinaryOpIC::TypeInfo new_overall = Max(new_left, new_right);
2690 BinaryOpIC::TypeInfo previous_overall = Max(previous_left, previous_right); 2689 BinaryOpIC::TypeInfo previous_overall = Max(previous_left, previous_right);
2691 2690
2692 bool previous_has_fixed_right_arg = 2691 Maybe<int> previous_fixed_right_arg =
2693 BinaryOpStub::decode_has_fixed_right_arg_from_minor_key(key); 2692 BinaryOpStub::decode_fixed_right_arg_from_minor_key(key);
2694 int previous_fixed_right_arg_value =
2695 BinaryOpStub::decode_fixed_right_arg_value_from_minor_key(key);
2696 2693
2697 int32_t value; 2694 int32_t value;
2698 bool new_has_fixed_right_arg = 2695 bool new_has_fixed_right_arg =
2699 op == Token::MOD && 2696 op == Token::MOD &&
2700 right->ToInt32(&value) && 2697 right->ToInt32(&value) &&
2701 BinaryOpStub::can_encode_arg_value(value) && 2698 BinaryOpStub::can_encode_arg_value(value) &&
2702 (previous_overall == BinaryOpIC::UNINITIALIZED || 2699 (previous_overall == BinaryOpIC::UNINITIALIZED ||
2703 (previous_has_fixed_right_arg && 2700 (previous_fixed_right_arg.has_value &&
2704 previous_fixed_right_arg_value == value)); 2701 previous_fixed_right_arg.value == value));
2705 int32_t new_fixed_right_arg_value = new_has_fixed_right_arg ? value : 1; 2702 Maybe<int32_t> new_fixed_right_arg(
2703 new_has_fixed_right_arg, new_has_fixed_right_arg ? value : 1);
2706 2704
2707 if (previous_has_fixed_right_arg == new_has_fixed_right_arg) { 2705 if (previous_fixed_right_arg.has_value == new_fixed_right_arg.has_value) {
2708 if (new_overall == BinaryOpIC::SMI && previous_overall == BinaryOpIC::SMI) { 2706 if (new_overall == BinaryOpIC::SMI && previous_overall == BinaryOpIC::SMI) {
2709 if (op == Token::DIV || 2707 if (op == Token::DIV ||
2710 op == Token::MUL || 2708 op == Token::MUL ||
2711 op == Token::SHR || 2709 op == Token::SHR ||
2712 kSmiValueSize == 32) { 2710 kSmiValueSize == 32) {
2713 // Arithmetic on two Smi inputs has yielded a heap number. 2711 // Arithmetic on two Smi inputs has yielded a heap number.
2714 // That is the only way to get here from the Smi stub. 2712 // That is the only way to get here from the Smi stub.
2715 // With 32-bit Smis, all overflows give heap numbers, but with 2713 // With 32-bit Smis, all overflows give heap numbers, but with
2716 // 31-bit Smis, most operations overflow to int32 results. 2714 // 31-bit Smis, most operations overflow to int32 results.
2717 result_type = BinaryOpIC::NUMBER; 2715 result_type = BinaryOpIC::NUMBER;
2718 } else { 2716 } else {
2719 // Other operations on SMIs that overflow yield int32s. 2717 // Other operations on SMIs that overflow yield int32s.
2720 result_type = BinaryOpIC::INT32; 2718 result_type = BinaryOpIC::INT32;
2721 } 2719 }
2722 } 2720 }
2723 if (new_overall == BinaryOpIC::INT32 && 2721 if (new_overall == BinaryOpIC::INT32 &&
2724 previous_overall == BinaryOpIC::INT32) { 2722 previous_overall == BinaryOpIC::INT32) {
2725 if (new_left == previous_left && new_right == previous_right) { 2723 if (new_left == previous_left && new_right == previous_right) {
2726 result_type = BinaryOpIC::NUMBER; 2724 result_type = BinaryOpIC::NUMBER;
2727 } 2725 }
2728 } 2726 }
2729 } 2727 }
2730 2728
2731 BinaryOpStub stub(key, new_left, new_right, result_type, 2729 BinaryOpStub stub(key, new_left, new_right, result_type, new_fixed_right_arg);
2732 new_has_fixed_right_arg, new_fixed_right_arg_value);
2733 Handle<Code> code = stub.GetCode(isolate); 2730 Handle<Code> code = stub.GetCode(isolate);
2734 if (!code.is_null()) { 2731 if (!code.is_null()) {
2735 #ifdef DEBUG 2732 #ifdef DEBUG
2736 if (FLAG_trace_ic) { 2733 if (FLAG_trace_ic) {
2737 PrintF("[BinaryOpIC in "); 2734 PrintF("[BinaryOpIC in ");
2738 JavaScriptFrame::PrintTop(isolate, stdout, false, true); 2735 JavaScriptFrame::PrintTop(isolate, stdout, false, true);
2739 PrintF(" "); 2736 PrintF(" ");
2740 TraceBinaryOp(previous_left, previous_right, previous_has_fixed_right_arg, 2737 TraceBinaryOp(previous_left, previous_right, previous_fixed_right_arg,
2741 previous_fixed_right_arg_value, previous_result); 2738 previous_result);
2742 PrintF(" => "); 2739 PrintF(" => ");
2743 TraceBinaryOp(new_left, new_right, new_has_fixed_right_arg, 2740 TraceBinaryOp(new_left, new_right, new_fixed_right_arg, result_type);
2744 new_fixed_right_arg_value, result_type);
2745 PrintF(" #%s @ %p]\n", Token::Name(op), static_cast<void*>(*code)); 2741 PrintF(" #%s @ %p]\n", Token::Name(op), static_cast<void*>(*code));
2746 } 2742 }
2747 #endif 2743 #endif
2748 BinaryOpIC ic(isolate); 2744 BinaryOpIC ic(isolate);
2749 ic.patch(*code); 2745 ic.patch(*code);
2750 2746
2751 // Activate inlined smi code. 2747 // Activate inlined smi code.
2752 if (previous_overall == BinaryOpIC::UNINITIALIZED) { 2748 if (previous_overall == BinaryOpIC::UNINITIALIZED) {
2753 PatchInlinedSmiCode(ic.address(), ENABLE_INLINED_SMI_CHECK); 2749 PatchInlinedSmiCode(ic.address(), ENABLE_INLINED_SMI_CHECK);
2754 } 2750 }
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
2842 2838
2843 2839
2844 Handle<Type> CompareIC::StateToType( 2840 Handle<Type> CompareIC::StateToType(
2845 Isolate* isolate, 2841 Isolate* isolate,
2846 CompareIC::State state, 2842 CompareIC::State state,
2847 Handle<Map> map) { 2843 Handle<Map> map) {
2848 switch (state) { 2844 switch (state) {
2849 case CompareIC::UNINITIALIZED: 2845 case CompareIC::UNINITIALIZED:
2850 return handle(Type::None(), isolate); 2846 return handle(Type::None(), isolate);
2851 case CompareIC::SMI: 2847 case CompareIC::SMI:
2852 return handle(Type::Integer31(), isolate); 2848 return handle(Type::Smi(), isolate);
2853 case CompareIC::NUMBER: 2849 case CompareIC::NUMBER:
2854 return handle(Type::Number(), isolate); 2850 return handle(Type::Number(), isolate);
2855 case CompareIC::STRING: 2851 case CompareIC::STRING:
2856 return handle(Type::String(), isolate); 2852 return handle(Type::String(), isolate);
2857 case CompareIC::INTERNALIZED_STRING: 2853 case CompareIC::INTERNALIZED_STRING:
2858 return handle(Type::InternalizedString(), isolate); 2854 return handle(Type::InternalizedString(), isolate);
2859 case CompareIC::UNIQUE_NAME: 2855 case CompareIC::UNIQUE_NAME:
2860 return handle(Type::UniqueName(), isolate); 2856 return handle(Type::UniqueName(), isolate);
2861 case CompareIC::OBJECT: 2857 case CompareIC::OBJECT:
2862 return handle(Type::Receiver(), isolate); 2858 return handle(Type::Receiver(), isolate);
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
3136 #undef ADDR 3132 #undef ADDR
3137 }; 3133 };
3138 3134
3139 3135
3140 Address IC::AddressFromUtilityId(IC::UtilityId id) { 3136 Address IC::AddressFromUtilityId(IC::UtilityId id) {
3141 return IC_utilities[id]; 3137 return IC_utilities[id];
3142 } 3138 }
3143 3139
3144 3140
3145 } } // namespace v8::internal 3141 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ia32/macro-assembler-ia32.cc ('k') | src/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698