Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(480)

Side by Side Diff: src/runtime/runtime-array.cc

Issue 2405253006: [builtins] implement Array.prototype[@@iterator] in TFJ builtins (Closed)
Patch Set: add array_iterator_protector, and check array_protector in holey fast arrays Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 } else { 64 } else {
65 FastArrayPushStub stub(isolate); 65 FastArrayPushStub stub(isolate);
66 InstallCode(isolate, holder, "push", stub.GetCode()); 66 InstallCode(isolate, holder, "push", stub.GetCode());
67 } 67 }
68 InstallBuiltin(isolate, holder, "shift", Builtins::kArrayShift); 68 InstallBuiltin(isolate, holder, "shift", Builtins::kArrayShift);
69 InstallBuiltin(isolate, holder, "unshift", Builtins::kArrayUnshift); 69 InstallBuiltin(isolate, holder, "unshift", Builtins::kArrayUnshift);
70 InstallBuiltin(isolate, holder, "slice", Builtins::kArraySlice); 70 InstallBuiltin(isolate, holder, "slice", Builtins::kArraySlice);
71 InstallBuiltin(isolate, holder, "splice", Builtins::kArraySplice); 71 InstallBuiltin(isolate, holder, "splice", Builtins::kArraySplice);
72 InstallBuiltin(isolate, holder, "includes", Builtins::kArrayIncludes, 2); 72 InstallBuiltin(isolate, holder, "includes", Builtins::kArrayIncludes, 2);
73 InstallBuiltin(isolate, holder, "indexOf", Builtins::kArrayIndexOf, 2); 73 InstallBuiltin(isolate, holder, "indexOf", Builtins::kArrayIndexOf, 2);
74 InstallBuiltin(isolate, holder, "keys", Builtins::kArrayPrototypeKeys, 0);
75 InstallBuiltin(isolate, holder, "values", Builtins::kArrayPrototypeValues, 0);
76 InstallBuiltin(isolate, holder, "entries", Builtins::kArrayPrototypeEntries,
77 0);
74 78
75 return *holder; 79 return *holder;
76 } 80 }
77 81
78 82
79 RUNTIME_FUNCTION(Runtime_FixedArrayGet) { 83 RUNTIME_FUNCTION(Runtime_FixedArrayGet) {
80 SealHandleScope shs(isolate); 84 SealHandleScope shs(isolate);
81 DCHECK(args.length() == 2); 85 DCHECK(args.length() == 2);
82 CONVERT_ARG_CHECKED(FixedArray, object, 0); 86 CONVERT_ARG_CHECKED(FixedArray, object, 0);
83 CONVERT_SMI_ARG_CHECKED(index, 1); 87 CONVERT_SMI_ARG_CHECKED(index, 1);
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, element_k, 636 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, element_k,
633 Object::GetProperty(&it)); 637 Object::GetProperty(&it));
634 if (search_element->StrictEquals(*element_k)) { 638 if (search_element->StrictEquals(*element_k)) {
635 return *index_obj; 639 return *index_obj;
636 } 640 }
637 } 641 }
638 } 642 }
639 return Smi::FromInt(-1); 643 return Smi::FromInt(-1);
640 } 644 }
641 645
646 RUNTIME_FUNCTION(Runtime_InvalidateArrayIteratorProtector) {
647 isolate->InvalidateArrayIteratorProtector();
648 return isolate->heap()->undefined_value();
649 }
650
642 } // namespace internal 651 } // namespace internal
643 } // namespace v8 652 } // namespace v8
OLDNEW
« src/builtins/builtins-array.cc ('K') | « src/runtime/runtime.h ('k') | src/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698