| 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/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/api.h" | 7 #include "src/api.h" |
| 8 #include "src/arguments.h" | 8 #include "src/arguments.h" |
| 9 #include "src/base/once.h" | 9 #include "src/base/once.h" |
| 10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
| (...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 | 636 |
| 637 if (!array->HasFastElements()) { | 637 if (!array->HasFastElements()) { |
| 638 AllowHeapAllocation allow_allocation; | 638 AllowHeapAllocation allow_allocation; |
| 639 return CallJsBuiltin(isolate, "ArraySlice", args); | 639 return CallJsBuiltin(isolate, "ArraySlice", args); |
| 640 } | 640 } |
| 641 | 641 |
| 642 len = Smi::cast(array->length())->value(); | 642 len = Smi::cast(array->length())->value(); |
| 643 } else { | 643 } else { |
| 644 // Array.slice(arguments, ...) is quite a common idiom (notably more | 644 // Array.slice(arguments, ...) is quite a common idiom (notably more |
| 645 // than 50% of invocations in Web apps). Treat it in C++ as well. | 645 // than 50% of invocations in Web apps). Treat it in C++ as well. |
| 646 Map* arguments_map = | 646 Map* arguments_map = isolate->context()->native_context()-> |
| 647 isolate->context()->native_context()->sloppy_arguments_map(); | 647 sloppy_arguments_boilerplate()->map(); |
| 648 | 648 |
| 649 bool is_arguments_object_with_fast_elements = | 649 bool is_arguments_object_with_fast_elements = |
| 650 receiver->IsJSObject() && | 650 receiver->IsJSObject() && |
| 651 JSObject::cast(*receiver)->map() == arguments_map; | 651 JSObject::cast(*receiver)->map() == arguments_map; |
| 652 if (!is_arguments_object_with_fast_elements) { | 652 if (!is_arguments_object_with_fast_elements) { |
| 653 AllowHeapAllocation allow_allocation; | 653 AllowHeapAllocation allow_allocation; |
| 654 return CallJsBuiltin(isolate, "ArraySlice", args); | 654 return CallJsBuiltin(isolate, "ArraySlice", args); |
| 655 } | 655 } |
| 656 JSObject* object = JSObject::cast(*receiver); | 656 JSObject* object = JSObject::cast(*receiver); |
| 657 | 657 |
| (...skipping 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1712 } | 1712 } |
| 1713 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 1713 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
| 1714 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 1714 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
| 1715 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) | 1715 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) |
| 1716 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 1716 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
| 1717 #undef DEFINE_BUILTIN_ACCESSOR_C | 1717 #undef DEFINE_BUILTIN_ACCESSOR_C |
| 1718 #undef DEFINE_BUILTIN_ACCESSOR_A | 1718 #undef DEFINE_BUILTIN_ACCESSOR_A |
| 1719 | 1719 |
| 1720 | 1720 |
| 1721 } } // namespace v8::internal | 1721 } } // namespace v8::internal |
| OLD | NEW |