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

Side by Side Diff: src/arguments.h

Issue 1398643002: Revert of Reland: Introduce a V8_NORETURN macro and use it to make GCC 4.9.2 happy again. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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
« no previous file with comments | « include/v8config.h ('k') | src/base/logging.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 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 #ifndef V8_ARGUMENTS_H_ 5 #ifndef V8_ARGUMENTS_H_
6 #define V8_ARGUMENTS_H_ 6 #define V8_ARGUMENTS_H_
7 7
8 #include "src/allocation.h" 8 #include "src/allocation.h"
9 #include "src/isolate.h" 9 #include "src/isolate.h"
10 10
(...skipping 11 matching lines...) Expand all
22 // Object* Runtime_function(Arguments args) { 22 // Object* Runtime_function(Arguments args) {
23 // ... use args[i] here ... 23 // ... use args[i] here ...
24 // } 24 // }
25 // 25 //
26 // Note that length_ (whose value is in the integer range) is defined 26 // Note that length_ (whose value is in the integer range) is defined
27 // as intptr_t to provide endian-neutrality on 64-bit archs. 27 // as intptr_t to provide endian-neutrality on 64-bit archs.
28 28
29 class Arguments BASE_EMBEDDED { 29 class Arguments BASE_EMBEDDED {
30 public: 30 public:
31 Arguments(int length, Object** arguments) 31 Arguments(int length, Object** arguments)
32 : length_(length), arguments_(arguments) { 32 : length_(length), arguments_(arguments) { }
33 DCHECK_GE(length_, 0);
34 }
35 33
36 Object*& operator[] (int index) { 34 Object*& operator[] (int index) {
37 DCHECK_GE(index, 0); 35 DCHECK(0 <= index && index < length_);
38 DCHECK_LT(static_cast<uint32_t>(index), static_cast<uint32_t>(length_));
39 return *(reinterpret_cast<Object**>(reinterpret_cast<intptr_t>(arguments_) - 36 return *(reinterpret_cast<Object**>(reinterpret_cast<intptr_t>(arguments_) -
40 index * kPointerSize)); 37 index * kPointerSize));
41 } 38 }
42 39
43 template <class S> Handle<S> at(int index) { 40 template <class S> Handle<S> at(int index) {
44 Object** value = &((*this)[index]); 41 Object** value = &((*this)[index]);
45 // This cast checks that the object we're accessing does indeed have the 42 // This cast checks that the object we're accessing does indeed have the
46 // expected type. 43 // expected type.
47 S::cast(*value); 44 S::cast(*value);
48 return Handle<S>(reinterpret_cast<S**>(value)); 45 return Handle<S>(reinterpret_cast<S**>(value));
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 280
284 281
285 #define RUNTIME_FUNCTION(Name) RUNTIME_FUNCTION_RETURNS_TYPE(Object*, Name) 282 #define RUNTIME_FUNCTION(Name) RUNTIME_FUNCTION_RETURNS_TYPE(Object*, Name)
286 #define RUNTIME_FUNCTION_RETURN_PAIR(Name) \ 283 #define RUNTIME_FUNCTION_RETURN_PAIR(Name) \
287 RUNTIME_FUNCTION_RETURNS_TYPE(ObjectPair, Name) 284 RUNTIME_FUNCTION_RETURNS_TYPE(ObjectPair, Name)
288 285
289 } // namespace internal 286 } // namespace internal
290 } // namespace v8 287 } // namespace v8
291 288
292 #endif // V8_ARGUMENTS_H_ 289 #endif // V8_ARGUMENTS_H_
OLDNEW
« no previous file with comments | « include/v8config.h ('k') | src/base/logging.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698