| 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/code-stubs.h" | 8 #include "src/code-stubs.h" |
| 9 #include "src/conversions-inl.h" | 9 #include "src/conversions-inl.h" |
| 10 #include "src/elements.h" | 10 #include "src/elements.h" |
| 11 #include "src/factory.h" | 11 #include "src/factory.h" |
| 12 #include "src/isolate-inl.h" | 12 #include "src/isolate-inl.h" |
| 13 #include "src/keys.h" | 13 #include "src/keys.h" |
| 14 #include "src/messages.h" | 14 #include "src/messages.h" |
| 15 #include "src/prototype.h" | 15 #include "src/prototype.h" |
| 16 | 16 |
| 17 namespace v8 { | 17 namespace v8 { |
| 18 namespace internal { | 18 namespace internal { |
| 19 | 19 |
| 20 RUNTIME_FUNCTION(Runtime_FinishArrayPrototypeSetup) { | |
| 21 HandleScope scope(isolate); | |
| 22 DCHECK_EQ(1, args.length()); | |
| 23 CONVERT_ARG_HANDLE_CHECKED(JSArray, prototype, 0); | |
| 24 Object* length = prototype->length(); | |
| 25 CHECK(length->IsSmi()); | |
| 26 CHECK(Smi::cast(length)->value() == 0); | |
| 27 CHECK(prototype->HasFastSmiOrObjectElements()); | |
| 28 // This is necessary to enable fast checks for absence of elements | |
| 29 // on Array.prototype and below. | |
| 30 prototype->set_elements(isolate->heap()->empty_fixed_array()); | |
| 31 return Smi::kZero; | |
| 32 } | |
| 33 | |
| 34 static void InstallCode( | 20 static void InstallCode( |
| 35 Isolate* isolate, Handle<JSObject> holder, const char* name, | 21 Isolate* isolate, Handle<JSObject> holder, const char* name, |
| 36 Handle<Code> code, int argc = -1, | 22 Handle<Code> code, int argc = -1, |
| 37 BuiltinFunctionId id = static_cast<BuiltinFunctionId>(-1)) { | 23 BuiltinFunctionId id = static_cast<BuiltinFunctionId>(-1)) { |
| 38 Handle<String> key = isolate->factory()->InternalizeUtf8String(name); | 24 Handle<String> key = isolate->factory()->InternalizeUtf8String(name); |
| 39 Handle<JSFunction> optimized = | 25 Handle<JSFunction> optimized = |
| 40 isolate->factory()->NewFunctionWithoutPrototype(key, code, true); | 26 isolate->factory()->NewFunctionWithoutPrototype(key, code, true); |
| 41 if (argc < 0) { | 27 if (argc < 0) { |
| 42 optimized->shared()->DontAdaptArguments(); | 28 optimized->shared()->DontAdaptArguments(); |
| 43 } else { | 29 } else { |
| (...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 DCHECK(accessor->HasElement(spread_array, i)); | 664 DCHECK(accessor->HasElement(spread_array, i)); |
| 679 Handle<Object> element = accessor->Get(spread_array, i); | 665 Handle<Object> element = accessor->Get(spread_array, i); |
| 680 result->set(i, *element); | 666 result->set(i, *element); |
| 681 } | 667 } |
| 682 | 668 |
| 683 return *result; | 669 return *result; |
| 684 } | 670 } |
| 685 | 671 |
| 686 } // namespace internal | 672 } // namespace internal |
| 687 } // namespace v8 | 673 } // namespace v8 |
| OLD | NEW |