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

Side by Side Diff: src/ic.cc

Issue 99173002: Use constant types to represent the fixed right arg of a MOD. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add comment. 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
« no previous file with comments | « src/ic.h ('k') | src/type-info.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 2311 matching lines...) Expand 10 before | Expand all | Expand 10 after
2322 // to include SSE2 as well as non-SSE2 versions in the snapshot. For code 2322 // to include SSE2 as well as non-SSE2 versions in the snapshot. For code
2323 // generation we always want it to reflect the current state. 2323 // generation we always want it to reflect the current state.
2324 op_ = static_cast<Token::Value>( 2324 op_ = static_cast<Token::Value>(
2325 FIRST_TOKEN + OpField::decode(extra_ic_state)); 2325 FIRST_TOKEN + OpField::decode(extra_ic_state));
2326 mode_ = OverwriteModeField::decode(extra_ic_state); 2326 mode_ = OverwriteModeField::decode(extra_ic_state);
2327 fixed_right_arg_ = Maybe<int>( 2327 fixed_right_arg_ = Maybe<int>(
2328 HasFixedRightArgField::decode(extra_ic_state), 2328 HasFixedRightArgField::decode(extra_ic_state),
2329 1 << FixedRightArgValueField::decode(extra_ic_state)); 2329 1 << FixedRightArgValueField::decode(extra_ic_state));
2330 left_kind_ = LeftKindField::decode(extra_ic_state); 2330 left_kind_ = LeftKindField::decode(extra_ic_state);
2331 if (fixed_right_arg_.has_value) { 2331 if (fixed_right_arg_.has_value) {
2332 right_kind_ = Smi::IsValid(fixed_right_arg_.value) ? SMI : INT32; 2332 // We have only 4 bits to encode the log2 of the fixed right arg, so the
2333 // max value is 2^(2^4), which is always a SMI.
2334 ASSERT(Smi::IsValid(fixed_right_arg_.value));
2335 right_kind_ = SMI;
2333 } else { 2336 } else {
2334 right_kind_ = RightKindField::decode(extra_ic_state); 2337 right_kind_ = RightKindField::decode(extra_ic_state);
2335 } 2338 }
2336 result_kind_ = ResultKindField::decode(extra_ic_state); 2339 result_kind_ = ResultKindField::decode(extra_ic_state);
2337 ASSERT_LE(FIRST_TOKEN, op_); 2340 ASSERT_LE(FIRST_TOKEN, op_);
2338 ASSERT_LE(op_, LAST_TOKEN); 2341 ASSERT_LE(op_, LAST_TOKEN);
2339 } 2342 }
2340 2343
2341 2344
2342 ExtraICState BinaryOpIC::State::GetExtraICState() const { 2345 ExtraICState BinaryOpIC::State::GetExtraICState() const {
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
2575 GENERATE(Token::MOD, SMI, 4, SMI, NO_OVERWRITE); 2578 GENERATE(Token::MOD, SMI, 4, SMI, NO_OVERWRITE);
2576 GENERATE(Token::MOD, SMI, 4, SMI, OVERWRITE_LEFT); 2579 GENERATE(Token::MOD, SMI, 4, SMI, OVERWRITE_LEFT);
2577 GENERATE(Token::MOD, SMI, 8, SMI, NO_OVERWRITE); 2580 GENERATE(Token::MOD, SMI, 8, SMI, NO_OVERWRITE);
2578 GENERATE(Token::MOD, SMI, 16, SMI, OVERWRITE_LEFT); 2581 GENERATE(Token::MOD, SMI, 16, SMI, OVERWRITE_LEFT);
2579 GENERATE(Token::MOD, SMI, 32, SMI, NO_OVERWRITE); 2582 GENERATE(Token::MOD, SMI, 32, SMI, NO_OVERWRITE);
2580 GENERATE(Token::MOD, SMI, 2048, SMI, NO_OVERWRITE); 2583 GENERATE(Token::MOD, SMI, 2048, SMI, NO_OVERWRITE);
2581 #undef GENERATE 2584 #undef GENERATE
2582 } 2585 }
2583 2586
2584 2587
2588 Handle<Type> BinaryOpIC::State::GetRightType(Isolate* isolate) const {
2589 if (fixed_right_arg_.has_value) {
2590 Handle<Smi> value = handle(Smi::FromInt(fixed_right_arg_.value), isolate);
2591 Handle<Type> type = handle(Type::Constant(value, isolate), isolate);
2592 ASSERT(type->Is(KindToType(right_kind_, isolate)));
2593 return type;
2594 }
2595 return KindToType(right_kind_, isolate);
2596 }
2597
2598
2585 Handle<Type> BinaryOpIC::State::GetResultType(Isolate* isolate) const { 2599 Handle<Type> BinaryOpIC::State::GetResultType(Isolate* isolate) const {
2586 Kind result_kind = result_kind_; 2600 Kind result_kind = result_kind_;
2587 if (HasSideEffects()) { 2601 if (HasSideEffects()) {
2588 result_kind = NONE; 2602 result_kind = NONE;
2589 } else if (result_kind == GENERIC && op_ == Token::ADD) { 2603 } else if (result_kind == GENERIC && op_ == Token::ADD) {
2590 return handle(Type::Union(handle(Type::Number(), isolate), 2604 return handle(Type::Union(handle(Type::Number(), isolate),
2591 handle(Type::String(), isolate)), isolate); 2605 handle(Type::String(), isolate)), isolate);
2592 } else if (result_kind == NUMBER && op_ == Token::SHR) { 2606 } else if (result_kind == NUMBER && op_ == Token::SHR) {
2593 return handle(Type::Unsigned32(), isolate); 2607 return handle(Type::Unsigned32(), isolate);
2594 } 2608 }
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
3143 #undef ADDR 3157 #undef ADDR
3144 }; 3158 };
3145 3159
3146 3160
3147 Address IC::AddressFromUtilityId(IC::UtilityId id) { 3161 Address IC::AddressFromUtilityId(IC::UtilityId id) {
3148 return IC_utilities[id]; 3162 return IC_utilities[id];
3149 } 3163 }
3150 3164
3151 3165
3152 } } // namespace v8::internal 3166 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ic.h ('k') | src/type-info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698