OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 } | 56 } |
57 | 57 |
58 template <class S> Handle<S> at(int index) { | 58 template <class S> Handle<S> at(int index) { |
59 Object** value = &((*this)[index]); | 59 Object** value = &((*this)[index]); |
60 // This cast checks that the object we're accessing does indeed have the | 60 // This cast checks that the object we're accessing does indeed have the |
61 // expected type. | 61 // expected type. |
62 S::cast(*value); | 62 S::cast(*value); |
63 return Handle<S>(reinterpret_cast<S**>(value)); | 63 return Handle<S>(reinterpret_cast<S**>(value)); |
64 } | 64 } |
65 | 65 |
| 66 int smi_at(int index) { |
| 67 return Smi::cast((*this)[index])->value(); |
| 68 } |
| 69 |
| 70 double number_at(int index) { |
| 71 return (*this)[index]->Number(); |
| 72 } |
| 73 |
66 // Get the total number of arguments including the receiver. | 74 // Get the total number of arguments including the receiver. |
67 int length() const { return length_; } | 75 int length() const { return length_; } |
68 | 76 |
69 Object** arguments() { return arguments_; } | 77 Object** arguments() { return arguments_; } |
70 private: | 78 private: |
71 int length_; | 79 int length_; |
72 Object** arguments_; | 80 Object** arguments_; |
73 }; | 81 }; |
74 | 82 |
75 | 83 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 #define RUNTIME_FUNCTION(Type, Name) \ | 117 #define RUNTIME_FUNCTION(Type, Name) \ |
110 Type Name(Arguments args, Isolate* isolate) | 118 Type Name(Arguments args, Isolate* isolate) |
111 | 119 |
112 | 120 |
113 #define RUNTIME_ARGUMENTS(isolate, args) args, isolate | 121 #define RUNTIME_ARGUMENTS(isolate, args) args, isolate |
114 | 122 |
115 | 123 |
116 } } // namespace v8::internal | 124 } } // namespace v8::internal |
117 | 125 |
118 #endif // V8_ARGUMENTS_H_ | 126 #endif // V8_ARGUMENTS_H_ |
OLD | NEW |