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

Side by Side Diff: src/arguments.h

Issue 1393023003: 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: avoid gcc 4.8 arm compiler bug on release and debug by moving checks to the bottom 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 }
33 35
34 Object*& operator[] (int index) { 36 Object*& operator[] (int index) {
35 DCHECK(0 <= index && index < length_); 37 DCHECK_GE(index, 0);
38 DCHECK_LT(static_cast<uint32_t>(index), static_cast<uint32_t>(length_));
36 return *(reinterpret_cast<Object**>(reinterpret_cast<intptr_t>(arguments_) - 39 return *(reinterpret_cast<Object**>(reinterpret_cast<intptr_t>(arguments_) -
37 index * kPointerSize)); 40 index * kPointerSize));
38 } 41 }
39 42
40 template <class S> Handle<S> at(int index) { 43 template <class S> Handle<S> at(int index) {
41 Object** value = &((*this)[index]); 44 Object** value = &((*this)[index]);
42 // This cast checks that the object we're accessing does indeed have the 45 // This cast checks that the object we're accessing does indeed have the
43 // expected type. 46 // expected type.
44 S::cast(*value); 47 S::cast(*value);
45 return Handle<S>(reinterpret_cast<S**>(value)); 48 return Handle<S>(reinterpret_cast<S**>(value));
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 283
281 284
282 #define RUNTIME_FUNCTION(Name) RUNTIME_FUNCTION_RETURNS_TYPE(Object*, Name) 285 #define RUNTIME_FUNCTION(Name) RUNTIME_FUNCTION_RETURNS_TYPE(Object*, Name)
283 #define RUNTIME_FUNCTION_RETURN_PAIR(Name) \ 286 #define RUNTIME_FUNCTION_RETURN_PAIR(Name) \
284 RUNTIME_FUNCTION_RETURNS_TYPE(ObjectPair, Name) 287 RUNTIME_FUNCTION_RETURNS_TYPE(ObjectPair, Name)
285 288
286 } // namespace internal 289 } // namespace internal
287 } // namespace v8 290 } // namespace v8
288 291
289 #endif // V8_ARGUMENTS_H_ 292 #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