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 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1254 UNREACHABLE(); | 1254 UNREACHABLE(); |
1255 break; | 1255 break; |
1256 } | 1256 } |
1257 visitor->increase_index_offset(length); | 1257 visitor->increase_index_offset(length); |
1258 return true; | 1258 return true; |
1259 } | 1259 } |
1260 | 1260 |
1261 | 1261 |
1262 bool HasConcatSpreadableModifier(Isolate* isolate, Handle<JSArray> obj) { | 1262 bool HasConcatSpreadableModifier(Isolate* isolate, Handle<JSArray> obj) { |
1263 DCHECK(isolate->IsFastArrayConstructorPrototypeChainIntact()); | 1263 DCHECK(isolate->IsFastArrayConstructorPrototypeChainIntact()); |
1264 if (!FLAG_harmony_concat_spreadable) return false; | |
1265 Handle<Symbol> key(isolate->factory()->is_concat_spreadable_symbol()); | 1264 Handle<Symbol> key(isolate->factory()->is_concat_spreadable_symbol()); |
1266 Maybe<bool> maybe = JSReceiver::HasProperty(obj, key); | 1265 Maybe<bool> maybe = JSReceiver::HasProperty(obj, key); |
1267 return maybe.FromMaybe(false); | 1266 return maybe.FromMaybe(false); |
1268 } | 1267 } |
1269 | 1268 |
1270 | 1269 |
1271 static Maybe<bool> IsConcatSpreadable(Isolate* isolate, Handle<Object> obj) { | 1270 static Maybe<bool> IsConcatSpreadable(Isolate* isolate, Handle<Object> obj) { |
1272 HandleScope handle_scope(isolate); | 1271 HandleScope handle_scope(isolate); |
1273 if (!obj->IsJSReceiver()) return Just(false); | 1272 if (!obj->IsJSReceiver()) return Just(false); |
1274 if (FLAG_harmony_concat_spreadable) { | 1273 Handle<Symbol> key(isolate->factory()->is_concat_spreadable_symbol()); |
1275 Handle<Symbol> key(isolate->factory()->is_concat_spreadable_symbol()); | 1274 Handle<Object> value; |
1276 Handle<Object> value; | 1275 MaybeHandle<Object> maybeValue = |
1277 MaybeHandle<Object> maybeValue = | 1276 i::Runtime::GetObjectProperty(isolate, obj, key); |
1278 i::Runtime::GetObjectProperty(isolate, obj, key); | 1277 if (!maybeValue.ToHandle(&value)) return Nothing<bool>(); |
1279 if (!maybeValue.ToHandle(&value)) return Nothing<bool>(); | 1278 if (!value->IsUndefined()) return Just(value->BooleanValue()); |
1280 if (!value->IsUndefined()) return Just(value->BooleanValue()); | |
1281 } | |
1282 return Object::IsArray(obj); | 1279 return Object::IsArray(obj); |
1283 } | 1280 } |
1284 | 1281 |
1285 | 1282 |
1286 Object* Slow_ArrayConcat(Arguments* args, Handle<Object> species, | 1283 Object* Slow_ArrayConcat(Arguments* args, Handle<Object> species, |
1287 Isolate* isolate) { | 1284 Isolate* isolate) { |
1288 int argument_count = args->length(); | 1285 int argument_count = args->length(); |
1289 | 1286 |
1290 bool is_array_species = *species == isolate->context()->array_function(); | 1287 bool is_array_species = *species == isolate->context()->array_function(); |
1291 | 1288 |
(...skipping 2910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4202 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 4199 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
4203 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 4200 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
4204 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) | 4201 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) |
4205 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 4202 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
4206 #undef DEFINE_BUILTIN_ACCESSOR_C | 4203 #undef DEFINE_BUILTIN_ACCESSOR_C |
4207 #undef DEFINE_BUILTIN_ACCESSOR_A | 4204 #undef DEFINE_BUILTIN_ACCESSOR_A |
4208 | 4205 |
4209 | 4206 |
4210 } // namespace internal | 4207 } // namespace internal |
4211 } // namespace v8 | 4208 } // namespace v8 |
OLD | NEW |