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/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.h" |
6 | 6 |
7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
8 #include "src/elements.h" | 8 #include "src/elements.h" |
9 #include "src/factory.h" | 9 #include "src/factory.h" |
10 #include "src/messages.h" | 10 #include "src/messages.h" |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 DCHECK_EQ(1, args.length()); | 274 DCHECK_EQ(1, args.length()); |
275 if (!args[0]->IsJSTypedArray()) { | 275 if (!args[0]->IsJSTypedArray()) { |
276 return isolate->heap()->false_value(); | 276 return isolate->heap()->false_value(); |
277 } | 277 } |
278 | 278 |
279 Handle<JSTypedArray> obj(JSTypedArray::cast(args[0])); | 279 Handle<JSTypedArray> obj(JSTypedArray::cast(args[0])); |
280 return isolate->heap()->ToBoolean(obj->GetBuffer()->is_shared() && | 280 return isolate->heap()->ToBoolean(obj->GetBuffer()->is_shared() && |
281 obj->type() == kExternalInt32Array); | 281 obj->type() == kExternalInt32Array); |
282 } | 282 } |
283 | 283 |
| 284 RUNTIME_FUNCTION(Runtime_TypedArraySpeciesCreateByLength) { |
| 285 HandleScope scope(isolate); |
| 286 DCHECK(args.length() == 2); |
| 287 Handle<JSTypedArray> exemplar = args.at<JSTypedArray>(1); |
| 288 Handle<Object> length = args.at(2); |
| 289 int argc = 1; |
| 290 ScopedVector<Handle<Object>> argv(argc); |
| 291 argv[0] = length; |
| 292 Handle<JSTypedArray> result_array; |
| 293 // TODO(tebbi): Pass correct method name. |
| 294 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 295 isolate, result_array, |
| 296 JSTypedArray::SpeciesCreate(isolate, exemplar, argc, argv.start(), "")); |
| 297 return *result_array; |
| 298 } |
| 299 |
284 } // namespace internal | 300 } // namespace internal |
285 } // namespace v8 | 301 } // namespace v8 |
OLD | NEW |