| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/bootstrapper.h" | 5 #include "src/bootstrapper.h" |
| 6 | 6 |
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/api-natives.h" | 8 #include "src/api-natives.h" |
| 9 #include "src/base/ieee754.h" | 9 #include "src/base/ieee754.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 1316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1327 JSObject::ForceSetPrototype(array_iterator_prototype, iterator_prototype); | 1327 JSObject::ForceSetPrototype(array_iterator_prototype, iterator_prototype); |
| 1328 | 1328 |
| 1329 JSObject::AddProperty( | 1329 JSObject::AddProperty( |
| 1330 array_iterator_prototype, factory->to_string_tag_symbol(), | 1330 array_iterator_prototype, factory->to_string_tag_symbol(), |
| 1331 factory->ArrayIterator_string(), | 1331 factory->ArrayIterator_string(), |
| 1332 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY)); | 1332 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY)); |
| 1333 | 1333 |
| 1334 Handle<JSFunction> next = InstallFunction( | 1334 Handle<JSFunction> next = InstallFunction( |
| 1335 array_iterator_prototype, "next", JS_OBJECT_TYPE, JSObject::kHeaderSize, | 1335 array_iterator_prototype, "next", JS_OBJECT_TYPE, JSObject::kHeaderSize, |
| 1336 MaybeHandle<JSObject>(), Builtins::kArrayIteratorPrototypeNext); | 1336 MaybeHandle<JSObject>(), Builtins::kArrayIteratorPrototypeNext); |
| 1337 next->shared()->set_builtin_function_id(kArrayIteratorNext); |
| 1337 | 1338 |
| 1338 // Set the expected parameters for %ArrayIteratorPrototype%.next to 0 (not | 1339 // Set the expected parameters for %ArrayIteratorPrototype%.next to 0 (not |
| 1339 // including the receiver), as required by the builtin. | 1340 // including the receiver), as required by the builtin. |
| 1340 next->shared()->set_internal_formal_parameter_count(0); | 1341 next->shared()->set_internal_formal_parameter_count(0); |
| 1341 | 1342 |
| 1342 // Set the length for the function to satisfy ECMA-262. | 1343 // Set the length for the function to satisfy ECMA-262. |
| 1343 next->shared()->set_length(0); | 1344 next->shared()->set_length(0); |
| 1344 | 1345 |
| 1345 Handle<JSFunction> array_iterator_function = CreateFunction( | 1346 Handle<JSFunction> array_iterator_function = CreateFunction( |
| 1346 isolate, factory->ArrayIterator_string(), | 1347 isolate, factory->ArrayIterator_string(), |
| (...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2180 Builtins::kTypedArrayPrototypeByteLength, true, | 2181 Builtins::kTypedArrayPrototypeByteLength, true, |
| 2181 kTypedArrayByteLength); | 2182 kTypedArrayByteLength); |
| 2182 SimpleInstallGetter(prototype, factory->byte_offset_string(), | 2183 SimpleInstallGetter(prototype, factory->byte_offset_string(), |
| 2183 Builtins::kTypedArrayPrototypeByteOffset, true, | 2184 Builtins::kTypedArrayPrototypeByteOffset, true, |
| 2184 kTypedArrayByteOffset); | 2185 kTypedArrayByteOffset); |
| 2185 SimpleInstallGetter(prototype, factory->length_string(), | 2186 SimpleInstallGetter(prototype, factory->length_string(), |
| 2186 Builtins::kTypedArrayPrototypeLength, true, | 2187 Builtins::kTypedArrayPrototypeLength, true, |
| 2187 kTypedArrayLength); | 2188 kTypedArrayLength); |
| 2188 | 2189 |
| 2189 // Install "keys", "values" and "entries" methods on the {prototype}. | 2190 // Install "keys", "values" and "entries" methods on the {prototype}. |
| 2190 SimpleInstallFunction(prototype, factory->entries_string(), | 2191 Handle<JSFunction> entries = |
| 2191 Builtins::kTypedArrayPrototypeEntries, 0, true); | 2192 SimpleInstallFunction(prototype, factory->entries_string(), |
| 2192 SimpleInstallFunction(prototype, factory->keys_string(), | 2193 Builtins::kTypedArrayPrototypeEntries, 0, true); |
| 2193 Builtins::kTypedArrayPrototypeKeys, 0, true); | 2194 entries->shared()->set_builtin_function_id(kTypedArrayEntries); |
| 2194 Handle<JSFunction> iterator = | 2195 |
| 2196 Handle<JSFunction> keys = |
| 2197 SimpleInstallFunction(prototype, factory->keys_string(), |
| 2198 Builtins::kTypedArrayPrototypeKeys, 0, true); |
| 2199 keys->shared()->set_builtin_function_id(kTypedArrayKeys); |
| 2200 |
| 2201 Handle<JSFunction> values = |
| 2195 SimpleInstallFunction(prototype, factory->values_string(), | 2202 SimpleInstallFunction(prototype, factory->values_string(), |
| 2196 Builtins::kTypedArrayPrototypeValues, 0, true); | 2203 Builtins::kTypedArrayPrototypeValues, 0, true); |
| 2197 JSObject::AddProperty(prototype, factory->iterator_symbol(), iterator, | 2204 values->shared()->set_builtin_function_id(kTypedArrayValues); |
| 2205 JSObject::AddProperty(prototype, factory->iterator_symbol(), values, |
| 2198 DONT_ENUM); | 2206 DONT_ENUM); |
| 2199 } | 2207 } |
| 2200 | 2208 |
| 2201 { // -- T y p e d A r r a y s | 2209 { // -- T y p e d A r r a y s |
| 2202 #define INSTALL_TYPED_ARRAY(Type, type, TYPE, ctype, size) \ | 2210 #define INSTALL_TYPED_ARRAY(Type, type, TYPE, ctype, size) \ |
| 2203 { \ | 2211 { \ |
| 2204 Handle<JSFunction> fun; \ | 2212 Handle<JSFunction> fun; \ |
| 2205 InstallTypedArray(#Type "Array", TYPE##_ELEMENTS, &fun); \ | 2213 InstallTypedArray(#Type "Array", TYPE##_ELEMENTS, &fun); \ |
| 2206 InstallWithIntrinsicDefaultProto(isolate, fun, \ | 2214 InstallWithIntrinsicDefaultProto(isolate, fun, \ |
| 2207 Context::TYPE##_ARRAY_FUN_INDEX); \ | 2215 Context::TYPE##_ARRAY_FUN_INDEX); \ |
| (...skipping 2344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4552 } | 4560 } |
| 4553 | 4561 |
| 4554 | 4562 |
| 4555 // Called when the top-level V8 mutex is destroyed. | 4563 // Called when the top-level V8 mutex is destroyed. |
| 4556 void Bootstrapper::FreeThreadResources() { | 4564 void Bootstrapper::FreeThreadResources() { |
| 4557 DCHECK(!IsActive()); | 4565 DCHECK(!IsActive()); |
| 4558 } | 4566 } |
| 4559 | 4567 |
| 4560 } // namespace internal | 4568 } // namespace internal |
| 4561 } // namespace v8 | 4569 } // namespace v8 |
| OLD | NEW |