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

Side by Side Diff: src/builtins/builtins-utils.h

Issue 2539093002: [runtime] Port simple String.prototype.indexOf cases to TF Builtin (Closed)
Patch Set: merging with master Created 4 years 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
« no previous file with comments | « src/builtins/builtins-string.cc ('k') | src/code-stub-assembler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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 #ifndef V8_BUILTINS_BUILTINS_UTILS_H_ 5 #ifndef V8_BUILTINS_BUILTINS_UTILS_H_
6 #define V8_BUILTINS_BUILTINS_UTILS_H_ 6 #define V8_BUILTINS_BUILTINS_UTILS_H_
7 7
8 #include "src/arguments.h" 8 #include "src/arguments.h"
9 #include "src/base/logging.h" 9 #include "src/base/logging.h"
10 #include "src/builtins/builtins.h" 10 #include "src/builtins/builtins.h"
(...skipping 12 matching lines...) Expand all
23 : Arguments(length, arguments) { 23 : Arguments(length, arguments) {
24 // Check we have at least the receiver. 24 // Check we have at least the receiver.
25 DCHECK_LE(1, this->length()); 25 DCHECK_LE(1, this->length());
26 } 26 }
27 27
28 Object*& operator[](int index) { 28 Object*& operator[](int index) {
29 DCHECK_LT(index, length()); 29 DCHECK_LT(index, length());
30 return Arguments::operator[](index); 30 return Arguments::operator[](index);
31 } 31 }
32 32
33 template <class S> 33 template <class S = Object>
34 Handle<S> at(int index) { 34 Handle<S> at(int index) {
35 DCHECK_LT(index, length()); 35 DCHECK_LT(index, length());
36 return Arguments::at<S>(index); 36 return Arguments::at<S>(index);
37 } 37 }
38 38
39 Handle<Object> atOrUndefined(Isolate* isolate, int index) { 39 Handle<Object> atOrUndefined(Isolate* isolate, int index) {
40 if (index >= length()) { 40 if (index >= length()) {
41 return isolate->factory()->undefined_value(); 41 return isolate->factory()->undefined_value();
42 } 42 }
43 return at<Object>(index); 43 return at<Object>(index);
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 isolate->factory()->NewStringFromAsciiChecked(method))); \ 153 isolate->factory()->NewStringFromAsciiChecked(method))); \
154 } \ 154 } \
155 Handle<String> name; \ 155 Handle<String> name; \
156 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( \ 156 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( \
157 isolate, name, Object::ToString(isolate, args.receiver())) 157 isolate, name, Object::ToString(isolate, args.receiver()))
158 158
159 } // namespace internal 159 } // namespace internal
160 } // namespace v8 160 } // namespace v8
161 161
162 #endif // V8_BUILTINS_BUILTINS_UTILS_H_ 162 #endif // V8_BUILTINS_BUILTINS_UTILS_H_
OLDNEW
« no previous file with comments | « src/builtins/builtins-string.cc ('k') | src/code-stub-assembler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698