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 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1179 JSReceiver::HasProperty(Handle<JSReceiver>::cast(obj), key); | 1179 JSReceiver::HasProperty(Handle<JSReceiver>::cast(obj), key); |
1180 if (!maybe.IsJust()) return false; | 1180 if (!maybe.IsJust()) return false; |
1181 return maybe.FromJust(); | 1181 return maybe.FromJust(); |
1182 } | 1182 } |
1183 | 1183 |
1184 | 1184 |
1185 bool IsConcatSpreadable(Isolate* isolate, Handle<Object> obj) { | 1185 bool IsConcatSpreadable(Isolate* isolate, Handle<Object> obj) { |
1186 HandleScope handle_scope(isolate); | 1186 HandleScope handle_scope(isolate); |
1187 if (!obj->IsSpecObject()) return false; | 1187 if (!obj->IsSpecObject()) return false; |
1188 if (FLAG_harmony_concat_spreadable) { | 1188 if (FLAG_harmony_concat_spreadable) { |
| 1189 // [[Get]] @@isConcatSpreadable from object. If an access check failed, |
| 1190 // ignore the resulting value and use the default behaviour. Otherwise, |
| 1191 // use the boolean value of the result. |
1189 Handle<Symbol> key(isolate->factory()->is_concat_spreadable_symbol()); | 1192 Handle<Symbol> key(isolate->factory()->is_concat_spreadable_symbol()); |
1190 Handle<Object> value; | 1193 Handle<Object> value; |
| 1194 bool access_check_failed; |
| 1195 LookupIterator it(obj, key, LookupIterator::DEFAULT); |
1191 MaybeHandle<Object> maybeValue = | 1196 MaybeHandle<Object> maybeValue = |
1192 i::Runtime::GetObjectProperty(isolate, obj, key); | 1197 Object::GetPropertyEx(&it, access_check_failed); |
1193 if (maybeValue.ToHandle(&value) && !value->IsUndefined()) { | 1198 if (!access_check_failed && maybeValue.ToHandle(&value) && |
| 1199 !value->IsUndefined()) { |
1194 return value->BooleanValue(); | 1200 return value->BooleanValue(); |
1195 } | 1201 } |
1196 } | 1202 } |
1197 return obj->IsJSArray(); | 1203 return obj->IsJSArray(); |
1198 } | 1204 } |
1199 | 1205 |
1200 | 1206 |
1201 /** | 1207 /** |
1202 * Array::concat implementation. | 1208 * Array::concat implementation. |
1203 * See ECMAScript 262, 15.4.4.4. | 1209 * See ECMAScript 262, 15.4.4.4. |
(...skipping 885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2089 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 2095 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
2090 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 2096 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
2091 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) | 2097 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) |
2092 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 2098 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
2093 #undef DEFINE_BUILTIN_ACCESSOR_C | 2099 #undef DEFINE_BUILTIN_ACCESSOR_C |
2094 #undef DEFINE_BUILTIN_ACCESSOR_A | 2100 #undef DEFINE_BUILTIN_ACCESSOR_A |
2095 | 2101 |
2096 | 2102 |
2097 } // namespace internal | 2103 } // namespace internal |
2098 } // namespace v8 | 2104 } // namespace v8 |
OLD | NEW |