OLD | NEW |
1 // Copyright 2007-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2009 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 1772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1783 class Arguments { | 1783 class Arguments { |
1784 public: | 1784 public: |
1785 inline int Length() const; | 1785 inline int Length() const; |
1786 inline Local<Value> operator[](int i) const; | 1786 inline Local<Value> operator[](int i) const; |
1787 inline Local<Function> Callee() const; | 1787 inline Local<Function> Callee() const; |
1788 inline Local<Object> This() const; | 1788 inline Local<Object> This() const; |
1789 inline Local<Object> Holder() const; | 1789 inline Local<Object> Holder() const; |
1790 inline bool IsConstructCall() const; | 1790 inline bool IsConstructCall() const; |
1791 inline Local<Value> Data() const; | 1791 inline Local<Value> Data() const; |
1792 private: | 1792 private: |
| 1793 static const int kDataIndex = 0; |
| 1794 static const int kCalleeIndex = -1; |
| 1795 static const int kHolderIndex = -2; |
| 1796 |
1793 friend class ImplementationUtilities; | 1797 friend class ImplementationUtilities; |
1794 inline Arguments(Local<Value> data, | 1798 inline Arguments(internal::Object** implicit_args, |
1795 Local<Object> holder, | 1799 internal::Object** values, |
1796 Local<Function> callee, | 1800 int length, |
1797 bool is_construct_call, | 1801 bool is_construct_call); |
1798 void** values, int length); | 1802 internal::Object** implicit_args_; |
1799 Local<Value> data_; | 1803 internal::Object** values_; |
1800 Local<Object> holder_; | 1804 int length_; |
1801 Local<Function> callee_; | |
1802 bool is_construct_call_; | 1805 bool is_construct_call_; |
1803 void** values_; | |
1804 int length_; | |
1805 }; | 1806 }; |
1806 | 1807 |
1807 | 1808 |
1808 /** | 1809 /** |
1809 * The information passed to an accessor callback about the context | 1810 * The information passed to an accessor callback about the context |
1810 * of the property access. | 1811 * of the property access. |
1811 */ | 1812 */ |
1812 class V8EXPORT AccessorInfo { | 1813 class V8EXPORT AccessorInfo { |
1813 public: | 1814 public: |
1814 inline AccessorInfo(internal::Object** args) | 1815 inline AccessorInfo(internal::Object** args) |
(...skipping 1648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3463 parameters, | 3464 parameters, |
3464 callback); | 3465 callback); |
3465 } | 3466 } |
3466 | 3467 |
3467 template <class T> | 3468 template <class T> |
3468 void Persistent<T>::ClearWeak() { | 3469 void Persistent<T>::ClearWeak() { |
3469 V8::ClearWeak(reinterpret_cast<internal::Object**>(**this)); | 3470 V8::ClearWeak(reinterpret_cast<internal::Object**>(**this)); |
3470 } | 3471 } |
3471 | 3472 |
3472 | 3473 |
3473 Arguments::Arguments(v8::Local<v8::Value> data, | 3474 Arguments::Arguments(internal::Object** implicit_args, |
3474 v8::Local<v8::Object> holder, | 3475 internal::Object** values, int length, |
3475 v8::Local<v8::Function> callee, | 3476 bool is_construct_call) |
3476 bool is_construct_call, | 3477 : implicit_args_(implicit_args), |
3477 void** values, int length) | 3478 values_(values), |
3478 : data_(data), holder_(holder), callee_(callee), | 3479 length_(length), |
3479 is_construct_call_(is_construct_call), | 3480 is_construct_call_(is_construct_call) { } |
3480 values_(values), length_(length) { } | |
3481 | 3481 |
3482 | 3482 |
3483 Local<Value> Arguments::operator[](int i) const { | 3483 Local<Value> Arguments::operator[](int i) const { |
3484 if (i < 0 || length_ <= i) return Local<Value>(*Undefined()); | 3484 if (i < 0 || length_ <= i) return Local<Value>(*Undefined()); |
3485 return Local<Value>(reinterpret_cast<Value*>(values_ - i)); | 3485 return Local<Value>(reinterpret_cast<Value*>(values_ - i)); |
3486 } | 3486 } |
3487 | 3487 |
3488 | 3488 |
3489 Local<Function> Arguments::Callee() const { | 3489 Local<Function> Arguments::Callee() const { |
3490 return callee_; | 3490 return Local<Function>(reinterpret_cast<Function*>( |
| 3491 &implicit_args_[kCalleeIndex])); |
3491 } | 3492 } |
3492 | 3493 |
3493 | 3494 |
3494 Local<Object> Arguments::This() const { | 3495 Local<Object> Arguments::This() const { |
3495 return Local<Object>(reinterpret_cast<Object*>(values_ + 1)); | 3496 return Local<Object>(reinterpret_cast<Object*>(values_ + 1)); |
3496 } | 3497 } |
3497 | 3498 |
3498 | 3499 |
3499 Local<Object> Arguments::Holder() const { | 3500 Local<Object> Arguments::Holder() const { |
3500 return holder_; | 3501 return Local<Object>(reinterpret_cast<Object*>( |
| 3502 &implicit_args_[kHolderIndex])); |
3501 } | 3503 } |
3502 | 3504 |
3503 | 3505 |
3504 Local<Value> Arguments::Data() const { | 3506 Local<Value> Arguments::Data() const { |
3505 return data_; | 3507 return Local<Value>(reinterpret_cast<Value*>(&implicit_args_[kDataIndex])); |
3506 } | 3508 } |
3507 | 3509 |
3508 | 3510 |
3509 bool Arguments::IsConstructCall() const { | 3511 bool Arguments::IsConstructCall() const { |
3510 return is_construct_call_; | 3512 return is_construct_call_; |
3511 } | 3513 } |
3512 | 3514 |
3513 | 3515 |
3514 int Arguments::Length() const { | 3516 int Arguments::Length() const { |
3515 return length_; | 3517 return length_; |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3745 | 3747 |
3746 | 3748 |
3747 } // namespace v8 | 3749 } // namespace v8 |
3748 | 3750 |
3749 | 3751 |
3750 #undef V8EXPORT | 3752 #undef V8EXPORT |
3751 #undef TYPE_CHECK | 3753 #undef TYPE_CHECK |
3752 | 3754 |
3753 | 3755 |
3754 #endif // V8_H_ | 3756 #endif // V8_H_ |
OLD | NEW |