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 "src/builtins.h" | 5 #include "src/builtins.h" |
6 | 6 |
7 #include "src/api.h" | 7 #include "src/api.h" |
8 #include "src/api-natives.h" | 8 #include "src/api-natives.h" |
9 #include "src/arguments.h" | 9 #include "src/arguments.h" |
10 #include "src/base/once.h" | 10 #include "src/base/once.h" |
(...skipping 1607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1618 if (!details.IsEnumerable()) continue; | 1618 if (!details.IsEnumerable()) continue; |
1619 if (details.kind() == kData) { | 1619 if (details.kind() == kData) { |
1620 if (details.location() == kDescriptor) { | 1620 if (details.location() == kDescriptor) { |
1621 prop_value = handle(descriptors->GetValue(i), isolate); | 1621 prop_value = handle(descriptors->GetValue(i), isolate); |
1622 } else { | 1622 } else { |
1623 Representation representation = details.representation(); | 1623 Representation representation = details.representation(); |
1624 FieldIndex index = FieldIndex::ForDescriptor(*map, i); | 1624 FieldIndex index = FieldIndex::ForDescriptor(*map, i); |
1625 prop_value = JSObject::FastPropertyAt(from, representation, index); | 1625 prop_value = JSObject::FastPropertyAt(from, representation, index); |
1626 } | 1626 } |
1627 } else { | 1627 } else { |
1628 ASSIGN_RETURN_ON_EXCEPTION_VALUE( | 1628 ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, prop_value, |
1629 isolate, prop_value, Object::GetProperty(from, next_key, STRICT), | 1629 Object::GetProperty(from, next_key), |
1630 Nothing<bool>()); | 1630 Nothing<bool>()); |
1631 } | 1631 } |
1632 } else { | 1632 } else { |
1633 // If the map did change, do a slower lookup. We are still guaranteed that | 1633 // If the map did change, do a slower lookup. We are still guaranteed that |
1634 // the object has a simple shape, and that the key is a name. | 1634 // the object has a simple shape, and that the key is a name. |
1635 LookupIterator it(from, next_key, LookupIterator::OWN_SKIP_INTERCEPTOR); | 1635 LookupIterator it(from, next_key, LookupIterator::OWN_SKIP_INTERCEPTOR); |
1636 if (!it.IsFound()) continue; | 1636 if (!it.IsFound()) continue; |
1637 DCHECK(it.state() == LookupIterator::DATA || | 1637 DCHECK(it.state() == LookupIterator::DATA || |
1638 it.state() == LookupIterator::ACCESSOR); | 1638 it.state() == LookupIterator::ACCESSOR); |
1639 if (!it.IsEnumerable()) continue; | 1639 if (!it.IsEnumerable()) continue; |
1640 ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, prop_value, | 1640 ASSIGN_RETURN_ON_EXCEPTION_VALUE( |
1641 Object::GetProperty(&it, STRICT), | 1641 isolate, prop_value, Object::GetProperty(&it), Nothing<bool>()); |
1642 Nothing<bool>()); | |
1643 } | 1642 } |
1644 Handle<Object> status; | 1643 Handle<Object> status; |
1645 ASSIGN_RETURN_ON_EXCEPTION_VALUE( | 1644 ASSIGN_RETURN_ON_EXCEPTION_VALUE( |
1646 isolate, status, | 1645 isolate, status, |
1647 Object::SetProperty(to, next_key, prop_value, STRICT, | 1646 Object::SetProperty(to, next_key, prop_value, STRICT, |
1648 Object::CERTAINLY_NOT_STORE_FROM_KEYED), | 1647 Object::CERTAINLY_NOT_STORE_FROM_KEYED), |
1649 Nothing<bool>()); | 1648 Nothing<bool>()); |
1650 } | 1649 } |
1651 | 1650 |
1652 return Just(true); | 1651 return Just(true); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1691 PropertyDescriptor desc; | 1690 PropertyDescriptor desc; |
1692 Maybe<bool> found = | 1691 Maybe<bool> found = |
1693 JSReceiver::GetOwnPropertyDescriptor(isolate, from, next_key, &desc); | 1692 JSReceiver::GetOwnPropertyDescriptor(isolate, from, next_key, &desc); |
1694 if (found.IsNothing()) return isolate->heap()->exception(); | 1693 if (found.IsNothing()) return isolate->heap()->exception(); |
1695 // 4c ii. If desc is not undefined and desc.[[Enumerable]] is true, then | 1694 // 4c ii. If desc is not undefined and desc.[[Enumerable]] is true, then |
1696 if (found.FromJust() && desc.enumerable()) { | 1695 if (found.FromJust() && desc.enumerable()) { |
1697 // 4c ii 1. Let propValue be ? Get(from, nextKey). | 1696 // 4c ii 1. Let propValue be ? Get(from, nextKey). |
1698 Handle<Object> prop_value; | 1697 Handle<Object> prop_value; |
1699 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 1698 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
1700 isolate, prop_value, | 1699 isolate, prop_value, |
1701 Runtime::GetObjectProperty(isolate, from, next_key, STRICT)); | 1700 Runtime::GetObjectProperty(isolate, from, next_key)); |
1702 // 4c ii 2. Let status be ? Set(to, nextKey, propValue, true). | 1701 // 4c ii 2. Let status be ? Set(to, nextKey, propValue, true). |
1703 Handle<Object> status; | 1702 Handle<Object> status; |
1704 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 1703 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
1705 isolate, status, Runtime::SetObjectProperty(isolate, to, next_key, | 1704 isolate, status, Runtime::SetObjectProperty(isolate, to, next_key, |
1706 prop_value, STRICT)); | 1705 prop_value, STRICT)); |
1707 } | 1706 } |
1708 } | 1707 } |
1709 } | 1708 } |
1710 // 5. Return to. | 1709 // 5. Return to. |
1711 return *to; | 1710 return *to; |
(...skipping 2326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4038 return HandleApiCallAsFunctionOrConstructor(isolate, true, args); | 4037 return HandleApiCallAsFunctionOrConstructor(isolate, true, args); |
4039 } | 4038 } |
4040 | 4039 |
4041 | 4040 |
4042 static void Generate_LoadIC_Miss(MacroAssembler* masm) { | 4041 static void Generate_LoadIC_Miss(MacroAssembler* masm) { |
4043 LoadIC::GenerateMiss(masm); | 4042 LoadIC::GenerateMiss(masm); |
4044 } | 4043 } |
4045 | 4044 |
4046 | 4045 |
4047 static void Generate_LoadIC_Normal(MacroAssembler* masm) { | 4046 static void Generate_LoadIC_Normal(MacroAssembler* masm) { |
4048 LoadIC::GenerateNormal(masm, SLOPPY); | 4047 LoadIC::GenerateNormal(masm); |
4049 } | 4048 } |
4050 | 4049 |
4051 | 4050 |
4052 static void Generate_LoadIC_Normal_Strong(MacroAssembler* masm) { | |
4053 LoadIC::GenerateNormal(masm, STRONG); | |
4054 } | |
4055 | |
4056 | |
4057 static void Generate_LoadIC_Getter_ForDeopt(MacroAssembler* masm) { | 4051 static void Generate_LoadIC_Getter_ForDeopt(MacroAssembler* masm) { |
4058 NamedLoadHandlerCompiler::GenerateLoadViaGetterForDeopt(masm); | 4052 NamedLoadHandlerCompiler::GenerateLoadViaGetterForDeopt(masm); |
4059 } | 4053 } |
4060 | 4054 |
4061 | 4055 |
4062 static void Generate_LoadIC_Slow(MacroAssembler* masm) { | 4056 static void Generate_LoadIC_Slow(MacroAssembler* masm) { |
4063 LoadIC::GenerateRuntimeGetProperty(masm, SLOPPY); | 4057 LoadIC::GenerateRuntimeGetProperty(masm); |
4064 } | |
4065 | |
4066 | |
4067 static void Generate_LoadIC_Slow_Strong(MacroAssembler* masm) { | |
4068 LoadIC::GenerateRuntimeGetProperty(masm, STRONG); | |
4069 } | 4058 } |
4070 | 4059 |
4071 | 4060 |
4072 static void Generate_KeyedLoadIC_Slow(MacroAssembler* masm) { | 4061 static void Generate_KeyedLoadIC_Slow(MacroAssembler* masm) { |
4073 KeyedLoadIC::GenerateRuntimeGetProperty(masm, SLOPPY); | 4062 KeyedLoadIC::GenerateRuntimeGetProperty(masm); |
4074 } | 4063 } |
4075 | 4064 |
4076 | 4065 |
4077 static void Generate_KeyedLoadIC_Slow_Strong(MacroAssembler* masm) { | |
4078 KeyedLoadIC::GenerateRuntimeGetProperty(masm, STRONG); | |
4079 } | |
4080 | |
4081 | |
4082 static void Generate_KeyedLoadIC_Miss(MacroAssembler* masm) { | 4066 static void Generate_KeyedLoadIC_Miss(MacroAssembler* masm) { |
4083 KeyedLoadIC::GenerateMiss(masm); | 4067 KeyedLoadIC::GenerateMiss(masm); |
4084 } | 4068 } |
4085 | 4069 |
4086 | 4070 |
4087 static void Generate_KeyedLoadIC_Megamorphic(MacroAssembler* masm) { | 4071 static void Generate_KeyedLoadIC_Megamorphic(MacroAssembler* masm) { |
4088 KeyedLoadIC::GenerateMegamorphic(masm, SLOPPY); | 4072 KeyedLoadIC::GenerateMegamorphic(masm); |
4089 } | 4073 } |
4090 | 4074 |
4091 | 4075 |
4092 static void Generate_KeyedLoadIC_Megamorphic_Strong(MacroAssembler* masm) { | |
4093 KeyedLoadIC::GenerateMegamorphic(masm, STRONG); | |
4094 } | |
4095 | |
4096 | |
4097 static void Generate_StoreIC_Miss(MacroAssembler* masm) { | 4076 static void Generate_StoreIC_Miss(MacroAssembler* masm) { |
4098 StoreIC::GenerateMiss(masm); | 4077 StoreIC::GenerateMiss(masm); |
4099 } | 4078 } |
4100 | 4079 |
4101 | 4080 |
4102 static void Generate_StoreIC_Normal(MacroAssembler* masm) { | 4081 static void Generate_StoreIC_Normal(MacroAssembler* masm) { |
4103 StoreIC::GenerateNormal(masm); | 4082 StoreIC::GenerateNormal(masm); |
4104 } | 4083 } |
4105 | 4084 |
4106 | 4085 |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4388 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 4367 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
4389 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 4368 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
4390 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) | 4369 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) |
4391 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 4370 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
4392 #undef DEFINE_BUILTIN_ACCESSOR_C | 4371 #undef DEFINE_BUILTIN_ACCESSOR_C |
4393 #undef DEFINE_BUILTIN_ACCESSOR_A | 4372 #undef DEFINE_BUILTIN_ACCESSOR_A |
4394 | 4373 |
4395 | 4374 |
4396 } // namespace internal | 4375 } // namespace internal |
4397 } // namespace v8 | 4376 } // namespace v8 |
OLD | NEW |