Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 45 // ... use args[i] here ... | 45 // ... use args[i] here ... |
| 46 // } | 46 // } |
| 47 | 47 |
| 48 class Arguments BASE_EMBEDDED { | 48 class Arguments BASE_EMBEDDED { |
| 49 public: | 49 public: |
| 50 Arguments(int length, Object** arguments) | 50 Arguments(int length, Object** arguments) |
| 51 : length_(length), arguments_(arguments) { } | 51 : length_(length), arguments_(arguments) { } |
| 52 | 52 |
| 53 Object*& operator[] (int index) { | 53 Object*& operator[] (int index) { |
| 54 ASSERT(0 <= index && index < length_); | 54 ASSERT(0 <= index && index < length_); |
| 55 return arguments_[-index]; | 55 return *(reinterpret_cast<Object**>(reinterpret_cast<intptr_t>(arguments_) - |
|
Jakob Kummerow
2013/06/10 14:43:38
The minus at the end of the line looks weird. I'd
| |
| 56 index * kPointerSize)); | |
| 56 } | 57 } |
| 57 | 58 |
| 58 template <class S> Handle<S> at(int index) { | 59 template <class S> Handle<S> at(int index) { |
| 59 Object** value = &((*this)[index]); | 60 Object** value = &((*this)[index]); |
| 60 // This cast checks that the object we're accessing does indeed have the | 61 // This cast checks that the object we're accessing does indeed have the |
| 61 // expected type. | 62 // expected type. |
| 62 S::cast(*value); | 63 S::cast(*value); |
| 63 return Handle<S>(reinterpret_cast<S**>(value)); | 64 return Handle<S>(reinterpret_cast<S**>(value)); |
| 64 } | 65 } |
| 65 | 66 |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 346 return __RT_impl_##Name(args, isolate); \ | 347 return __RT_impl_##Name(args, isolate); \ |
| 347 } \ | 348 } \ |
| 348 static Type __RT_impl_##Name(Arguments args, Isolate* isolate) | 349 static Type __RT_impl_##Name(Arguments args, Isolate* isolate) |
| 349 | 350 |
| 350 #define RUNTIME_ARGUMENTS(isolate, args) \ | 351 #define RUNTIME_ARGUMENTS(isolate, args) \ |
| 351 args.length(), args.arguments(), isolate | 352 args.length(), args.arguments(), isolate |
| 352 | 353 |
| 353 } } // namespace v8::internal | 354 } } // namespace v8::internal |
| 354 | 355 |
| 355 #endif // V8_ARGUMENTS_H_ | 356 #endif // V8_ARGUMENTS_H_ |
| OLD | NEW |