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

Side by Side Diff: src/builtins.cc

Issue 1870433003: Improve elements validation and object printing (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: addressing nits Created 4 years, 8 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
« no previous file with comments | « no previous file | src/elements.cc » ('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 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/builtins.h" 5 #include "src/builtins.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/api-arguments.h" 8 #include "src/api-arguments.h"
9 #include "src/api-natives.h" 9 #include "src/api-natives.h"
10 #include "src/base/once.h" 10 #include "src/base/once.h"
(...skipping 23 matching lines...) Expand all
34 template <BuiltinExtraArguments extra_args> 34 template <BuiltinExtraArguments extra_args>
35 class BuiltinArguments : public Arguments { 35 class BuiltinArguments : public Arguments {
36 public: 36 public:
37 BuiltinArguments(int length, Object** arguments) 37 BuiltinArguments(int length, Object** arguments)
38 : Arguments(length, arguments) { 38 : Arguments(length, arguments) {
39 // Check we have at least the receiver. 39 // Check we have at least the receiver.
40 DCHECK_LE(1, this->length()); 40 DCHECK_LE(1, this->length());
41 } 41 }
42 42
43 Object*& operator[] (int index) { 43 Object*& operator[] (int index) {
44 DCHECK(index < length()); 44 DCHECK_LT(index, length());
45 return Arguments::operator[](index); 45 return Arguments::operator[](index);
46 } 46 }
47 47
48 template <class S> Handle<S> at(int index) { 48 template <class S> Handle<S> at(int index) {
49 DCHECK(index < length()); 49 DCHECK_LT(index, length());
50 return Arguments::at<S>(index); 50 return Arguments::at<S>(index);
51 } 51 }
52 52
53 Handle<Object> atOrUndefined(Isolate* isolate, int index) { 53 Handle<Object> atOrUndefined(Isolate* isolate, int index) {
54 if (index >= length()) { 54 if (index >= length()) {
55 return isolate->factory()->undefined_value(); 55 return isolate->factory()->undefined_value();
56 } 56 }
57 return at<Object>(index); 57 return at<Object>(index);
58 } 58 }
59 59
(...skipping 4891 matching lines...) Expand 10 before | Expand all | Expand 10 after
4951 BUILTIN_LIST_T(DEFINE_BUILTIN_ACCESSOR_T) 4951 BUILTIN_LIST_T(DEFINE_BUILTIN_ACCESSOR_T)
4952 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) 4952 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H)
4953 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) 4953 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A)
4954 #undef DEFINE_BUILTIN_ACCESSOR_C 4954 #undef DEFINE_BUILTIN_ACCESSOR_C
4955 #undef DEFINE_BUILTIN_ACCESSOR_A 4955 #undef DEFINE_BUILTIN_ACCESSOR_A
4956 #undef DEFINE_BUILTIN_ACCESSOR_T 4956 #undef DEFINE_BUILTIN_ACCESSOR_T
4957 #undef DEFINE_BUILTIN_ACCESSOR_H 4957 #undef DEFINE_BUILTIN_ACCESSOR_H
4958 4958
4959 } // namespace internal 4959 } // namespace internal
4960 } // namespace v8 4960 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/elements.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698