| OLD | NEW | 
|     1 // Copyright 2012 the V8 project authors. All rights reserved. |     1 // Copyright 2012 the V8 project authors. All rights reserved. | 
|     2 // Use of this source code is governed by a BSD-style license that can be |     2 // Use of this source code is governed by a BSD-style license that can be | 
|     3 // found in the LICENSE file. |     3 // found in the LICENSE file. | 
|     4  |     4  | 
|     5 #include "v8.h" |     5 #include "v8.h" | 
|     6  |     6  | 
|     7 #include "accessors.h" |     7 #include "accessors.h" | 
|     8 #include "api.h" |     8 #include "api.h" | 
|     9 #include "arguments.h" |     9 #include "arguments.h" | 
|    10 #include "codegen.h" |    10 #include "codegen.h" | 
| (...skipping 2089 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2100   ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |  2100   ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 
|  2101       isolate, result, |  2101       isolate, result, | 
|  2102       Runtime::SetObjectProperty( |  2102       Runtime::SetObjectProperty( | 
|  2103           isolate, object, key, value, NONE, strict_mode)); |  2103           isolate, object, key, value, NONE, strict_mode)); | 
|  2104   return *result; |  2104   return *result; | 
|  2105 } |  2105 } | 
|  2106  |  2106  | 
|  2107  |  2107  | 
|  2108 BinaryOpIC::State::State(Isolate* isolate, ExtraICState extra_ic_state) |  2108 BinaryOpIC::State::State(Isolate* isolate, ExtraICState extra_ic_state) | 
|  2109     : isolate_(isolate) { |  2109     : isolate_(isolate) { | 
|  2110   // We don't deserialize the SSE2 Field, since this is only used to be able |  | 
|  2111   // to include SSE2 as well as non-SSE2 versions in the snapshot. For code |  | 
|  2112   // generation we always want it to reflect the current state. |  | 
|  2113   op_ = static_cast<Token::Value>( |  2110   op_ = static_cast<Token::Value>( | 
|  2114       FIRST_TOKEN + OpField::decode(extra_ic_state)); |  2111       FIRST_TOKEN + OpField::decode(extra_ic_state)); | 
|  2115   mode_ = OverwriteModeField::decode(extra_ic_state); |  2112   mode_ = OverwriteModeField::decode(extra_ic_state); | 
|  2116   fixed_right_arg_ = Maybe<int>( |  2113   fixed_right_arg_ = Maybe<int>( | 
|  2117       HasFixedRightArgField::decode(extra_ic_state), |  2114       HasFixedRightArgField::decode(extra_ic_state), | 
|  2118       1 << FixedRightArgValueField::decode(extra_ic_state)); |  2115       1 << FixedRightArgValueField::decode(extra_ic_state)); | 
|  2119   left_kind_ = LeftKindField::decode(extra_ic_state); |  2116   left_kind_ = LeftKindField::decode(extra_ic_state); | 
|  2120   if (fixed_right_arg_.has_value) { |  2117   if (fixed_right_arg_.has_value) { | 
|  2121     right_kind_ = Smi::IsValid(fixed_right_arg_.value) ? SMI : INT32; |  2118     right_kind_ = Smi::IsValid(fixed_right_arg_.value) ? SMI : INT32; | 
|  2122   } else { |  2119   } else { | 
|  2123     right_kind_ = RightKindField::decode(extra_ic_state); |  2120     right_kind_ = RightKindField::decode(extra_ic_state); | 
|  2124   } |  2121   } | 
|  2125   result_kind_ = ResultKindField::decode(extra_ic_state); |  2122   result_kind_ = ResultKindField::decode(extra_ic_state); | 
|  2126   ASSERT_LE(FIRST_TOKEN, op_); |  2123   ASSERT_LE(FIRST_TOKEN, op_); | 
|  2127   ASSERT_LE(op_, LAST_TOKEN); |  2124   ASSERT_LE(op_, LAST_TOKEN); | 
|  2128 } |  2125 } | 
|  2129  |  2126  | 
|  2130  |  2127  | 
|  2131 ExtraICState BinaryOpIC::State::GetExtraICState() const { |  2128 ExtraICState BinaryOpIC::State::GetExtraICState() const { | 
|  2132   bool sse2 = (Max(result_kind_, Max(left_kind_, right_kind_)) > SMI && |  | 
|  2133                CpuFeatures::IsSafeForSnapshot(isolate(), SSE2)); |  | 
|  2134   ExtraICState extra_ic_state = |  2129   ExtraICState extra_ic_state = | 
|  2135       SSE2Field::encode(sse2) | |  | 
|  2136       OpField::encode(op_ - FIRST_TOKEN) | |  2130       OpField::encode(op_ - FIRST_TOKEN) | | 
|  2137       OverwriteModeField::encode(mode_) | |  2131       OverwriteModeField::encode(mode_) | | 
|  2138       LeftKindField::encode(left_kind_) | |  2132       LeftKindField::encode(left_kind_) | | 
|  2139       ResultKindField::encode(result_kind_) | |  2133       ResultKindField::encode(result_kind_) | | 
|  2140       HasFixedRightArgField::encode(fixed_right_arg_.has_value); |  2134       HasFixedRightArgField::encode(fixed_right_arg_.has_value); | 
|  2141   if (fixed_right_arg_.has_value) { |  2135   if (fixed_right_arg_.has_value) { | 
|  2142     extra_ic_state = FixedRightArgValueField::update( |  2136     extra_ic_state = FixedRightArgValueField::update( | 
|  2143         extra_ic_state, WhichPowerOf2(fixed_right_arg_.value)); |  2137         extra_ic_state, WhichPowerOf2(fixed_right_arg_.value)); | 
|  2144   } else { |  2138   } else { | 
|  2145     extra_ic_state = RightKindField::update(extra_ic_state, right_kind_); |  2139     extra_ic_state = RightKindField::update(extra_ic_state, right_kind_); | 
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2446   if ((mode_ == OVERWRITE_LEFT && left_kind_ > NUMBER) || |  2440   if ((mode_ == OVERWRITE_LEFT && left_kind_ > NUMBER) || | 
|  2447       (mode_ == OVERWRITE_RIGHT && right_kind_ > NUMBER) || |  2441       (mode_ == OVERWRITE_RIGHT && right_kind_ > NUMBER) || | 
|  2448       result_kind_ > NUMBER) { |  2442       result_kind_ > NUMBER) { | 
|  2449     mode_ = NO_OVERWRITE; |  2443     mode_ = NO_OVERWRITE; | 
|  2450   } |  2444   } | 
|  2451  |  2445  | 
|  2452   if (old_extra_ic_state == GetExtraICState()) { |  2446   if (old_extra_ic_state == GetExtraICState()) { | 
|  2453     // Tagged operations can lead to non-truncating HChanges |  2447     // Tagged operations can lead to non-truncating HChanges | 
|  2454     if (left->IsUndefined() || left->IsBoolean()) { |  2448     if (left->IsUndefined() || left->IsBoolean()) { | 
|  2455       left_kind_ = GENERIC; |  2449       left_kind_ = GENERIC; | 
|  2456     } else if (right->IsUndefined() || right->IsBoolean()) { |  2450     } else { | 
 |  2451       ASSERT(right->IsUndefined() || right->IsBoolean()); | 
|  2457       right_kind_ = GENERIC; |  2452       right_kind_ = GENERIC; | 
|  2458     } else { |  | 
|  2459       // Since the X87 is too precise, we might bail out on numbers which |  | 
|  2460       // actually would truncate with 64 bit precision. |  | 
|  2461       ASSERT(!CpuFeatures::IsSupported(SSE2)); |  | 
|  2462       ASSERT(result_kind_ < NUMBER); |  | 
|  2463       result_kind_ = NUMBER; |  | 
|  2464     } |  2453     } | 
|  2465   } |  2454   } | 
|  2466 } |  2455 } | 
|  2467  |  2456  | 
|  2468  |  2457  | 
|  2469 BinaryOpIC::State::Kind BinaryOpIC::State::UpdateKind(Handle<Object> object, |  2458 BinaryOpIC::State::Kind BinaryOpIC::State::UpdateKind(Handle<Object> object, | 
|  2470                                                       Kind kind) const { |  2459                                                       Kind kind) const { | 
|  2471   Kind new_kind = GENERIC; |  2460   Kind new_kind = GENERIC; | 
|  2472   bool is_truncating = Token::IsTruncatingBinaryOp(op()); |  2461   bool is_truncating = Token::IsTruncatingBinaryOp(op()); | 
|  2473   if (object->IsBoolean() && is_truncating) { |  2462   if (object->IsBoolean() && is_truncating) { | 
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2996 #undef ADDR |  2985 #undef ADDR | 
|  2997 }; |  2986 }; | 
|  2998  |  2987  | 
|  2999  |  2988  | 
|  3000 Address IC::AddressFromUtilityId(IC::UtilityId id) { |  2989 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 
|  3001   return IC_utilities[id]; |  2990   return IC_utilities[id]; | 
|  3002 } |  2991 } | 
|  3003  |  2992  | 
|  3004  |  2993  | 
|  3005 } }  // namespace v8::internal |  2994 } }  // namespace v8::internal | 
| OLD | NEW |