| 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 2834 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2845   // Fast JS primitive setters |  2845   // Fast JS primitive setters | 
|  2846   V8_INLINE(void SetNull()); |  2846   V8_INLINE(void SetNull()); | 
|  2847   V8_INLINE(void SetUndefined()); |  2847   V8_INLINE(void SetUndefined()); | 
|  2848   // Convenience getter for Isolate |  2848   // Convenience getter for Isolate | 
|  2849   V8_INLINE(Isolate* GetIsolate()); |  2849   V8_INLINE(Isolate* GetIsolate()); | 
|  2850  |  2850  | 
|  2851  private: |  2851  private: | 
|  2852   template<class F> friend class ReturnValue; |  2852   template<class F> friend class ReturnValue; | 
|  2853   template<class F> friend class FunctionCallbackInfo; |  2853   template<class F> friend class FunctionCallbackInfo; | 
|  2854   template<class F> friend class PropertyCallbackInfo; |  2854   template<class F> friend class PropertyCallbackInfo; | 
 |  2855   V8_INLINE(internal::Object* GetDefaultValue()); | 
|  2855   V8_INLINE(explicit ReturnValue(internal::Object** slot)); |  2856   V8_INLINE(explicit ReturnValue(internal::Object** slot)); | 
|  2856   internal::Object** value_; |  2857   internal::Object** value_; | 
|  2857 }; |  2858 }; | 
|  2858  |  2859  | 
|  2859  |  2860  | 
|  2860 /** |  2861 /** | 
|  2861  * The argument information given to function call callbacks.  This |  2862  * The argument information given to function call callbacks.  This | 
|  2862  * class provides access to information about the context of the call, |  2863  * class provides access to information about the context of the call, | 
|  2863  * including the receiver, the number and values of arguments, and |  2864  * including the receiver, the number and values of arguments, and | 
|  2864  * the holder of the function. |  2865  * the holder of the function. | 
|  2865  */ |  2866  */ | 
|  2866 template<typename T> |  2867 template<typename T> | 
|  2867 class FunctionCallbackInfo { |  2868 class FunctionCallbackInfo { | 
|  2868  public: |  2869  public: | 
|  2869   V8_INLINE(int Length() const); |  2870   V8_INLINE(int Length() const); | 
|  2870   V8_INLINE(Local<Value> operator[](int i) const); |  2871   V8_INLINE(Local<Value> operator[](int i) const); | 
|  2871   V8_INLINE(Local<Function> Callee() const); |  2872   V8_INLINE(Local<Function> Callee() const); | 
|  2872   V8_INLINE(Local<Object> This() const); |  2873   V8_INLINE(Local<Object> This() const); | 
|  2873   V8_INLINE(Local<Object> Holder() const); |  2874   V8_INLINE(Local<Object> Holder() const); | 
|  2874   V8_INLINE(bool IsConstructCall() const); |  2875   V8_INLINE(bool IsConstructCall() const); | 
|  2875   V8_INLINE(Local<Value> Data() const); |  2876   V8_INLINE(Local<Value> Data() const); | 
|  2876   V8_INLINE(Isolate* GetIsolate() const); |  2877   V8_INLINE(Isolate* GetIsolate() const); | 
|  2877   V8_INLINE(ReturnValue<T> GetReturnValue() const); |  2878   V8_INLINE(ReturnValue<T> GetReturnValue() const); | 
|  2878   // This shouldn't be public, but the arm compiler needs it. |  2879   // This shouldn't be public, but the arm compiler needs it. | 
|  2879   static const int kArgsLength = 5; |  2880   static const int kArgsLength = 6; | 
|  2880  |  2881  | 
|  2881  protected: |  2882  protected: | 
|  2882   friend class internal::FunctionCallbackArguments; |  2883   friend class internal::FunctionCallbackArguments; | 
|  2883   friend class internal::CustomArguments<FunctionCallbackInfo>; |  2884   friend class internal::CustomArguments<FunctionCallbackInfo>; | 
|  2884   static const int kReturnValueIndex = 0; |  2885   static const int kReturnValueIndex = 0; | 
|  2885   static const int kIsolateIndex = -1; |  2886   static const int kReturnValueDefaultValueIndex = -1; | 
|  2886   static const int kDataIndex = -2; |  2887   static const int kIsolateIndex = -2; | 
|  2887   static const int kCalleeIndex = -3; |  2888   static const int kDataIndex = -3; | 
|  2888   static const int kHolderIndex = -4; |  2889   static const int kCalleeIndex = -4; | 
 |  2890   static const int kHolderIndex = -5; | 
|  2889  |  2891  | 
|  2890   V8_INLINE(FunctionCallbackInfo(internal::Object** implicit_args, |  2892   V8_INLINE(FunctionCallbackInfo(internal::Object** implicit_args, | 
|  2891                    internal::Object** values, |  2893                    internal::Object** values, | 
|  2892                    int length, |  2894                    int length, | 
|  2893                    bool is_construct_call)); |  2895                    bool is_construct_call)); | 
|  2894   internal::Object** implicit_args_; |  2896   internal::Object** implicit_args_; | 
|  2895   internal::Object** values_; |  2897   internal::Object** values_; | 
|  2896   int length_; |  2898   int length_; | 
|  2897   bool is_construct_call_; |  2899   bool is_construct_call_; | 
|  2898 }; |  2900 }; | 
| (...skipping 14 matching lines...) Expand all  Loading... | 
|  2913  */ |  2915  */ | 
|  2914 template<typename T> |  2916 template<typename T> | 
|  2915 class PropertyCallbackInfo { |  2917 class PropertyCallbackInfo { | 
|  2916  public: |  2918  public: | 
|  2917   V8_INLINE(Isolate* GetIsolate() const); |  2919   V8_INLINE(Isolate* GetIsolate() const); | 
|  2918   V8_INLINE(Local<Value> Data() const); |  2920   V8_INLINE(Local<Value> Data() const); | 
|  2919   V8_INLINE(Local<Object> This() const); |  2921   V8_INLINE(Local<Object> This() const); | 
|  2920   V8_INLINE(Local<Object> Holder() const); |  2922   V8_INLINE(Local<Object> Holder() const); | 
|  2921   V8_INLINE(ReturnValue<T> GetReturnValue() const); |  2923   V8_INLINE(ReturnValue<T> GetReturnValue() const); | 
|  2922   // This shouldn't be public, but the arm compiler needs it. |  2924   // This shouldn't be public, but the arm compiler needs it. | 
|  2923   static const int kArgsLength = 5; |  2925   static const int kArgsLength = 6; | 
|  2924  |  2926  | 
|  2925  protected: |  2927  protected: | 
|  2926   friend class MacroAssembler; |  2928   friend class MacroAssembler; | 
|  2927   friend class internal::PropertyCallbackArguments; |  2929   friend class internal::PropertyCallbackArguments; | 
|  2928   friend class internal::CustomArguments<PropertyCallbackInfo>; |  2930   friend class internal::CustomArguments<PropertyCallbackInfo>; | 
|  2929   static const int kThisIndex = 0; |  2931   static const int kThisIndex = 0; | 
|  2930   static const int kHolderIndex = -1; |  2932   static const int kHolderIndex = -1; | 
|  2931   static const int kDataIndex = -2; |  2933   static const int kDataIndex = -2; | 
|  2932   static const int kReturnValueIndex = -3; |  2934   static const int kReturnValueIndex = -3; | 
|  2933   static const int kIsolateIndex = -4; |  2935   static const int kReturnValueDefaultValueIndex = -4; | 
 |  2936   static const int kIsolateIndex = -5; | 
|  2934  |  2937  | 
|  2935   V8_INLINE(PropertyCallbackInfo(internal::Object** args)) |  2938   V8_INLINE(PropertyCallbackInfo(internal::Object** args)) | 
|  2936       : args_(args) { } |  2939       : args_(args) { } | 
|  2937   internal::Object** args_; |  2940   internal::Object** args_; | 
|  2938 }; |  2941 }; | 
|  2939  |  2942  | 
|  2940  |  2943  | 
|  2941 class V8EXPORT AccessorInfo : public PropertyCallbackInfo<Value> { |  2944 class V8EXPORT AccessorInfo : public PropertyCallbackInfo<Value> { | 
|  2942  private: |  2945  private: | 
|  2943   friend class internal::PropertyCallbackArguments; |  2946   friend class internal::PropertyCallbackArguments; | 
| (...skipping 2707 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  5651  |  5654  | 
|  5652  |  5655  | 
|  5653 template<typename T> |  5656 template<typename T> | 
|  5654 ReturnValue<T>::ReturnValue(internal::Object** slot) : value_(slot) {} |  5657 ReturnValue<T>::ReturnValue(internal::Object** slot) : value_(slot) {} | 
|  5655  |  5658  | 
|  5656 template<typename T> |  5659 template<typename T> | 
|  5657 template<typename S> |  5660 template<typename S> | 
|  5658 void ReturnValue<T>::Set(const Persistent<S>& handle) { |  5661 void ReturnValue<T>::Set(const Persistent<S>& handle) { | 
|  5659   TYPE_CHECK(T, S); |  5662   TYPE_CHECK(T, S); | 
|  5660   if (V8_UNLIKELY(handle.IsEmpty())) { |  5663   if (V8_UNLIKELY(handle.IsEmpty())) { | 
|  5661     SetUndefined(); |  5664     *value_ = GetDefaultValue(); | 
|  5662   } else { |  5665   } else { | 
|  5663     *value_ = *reinterpret_cast<internal::Object**>(*handle); |  5666     *value_ = *reinterpret_cast<internal::Object**>(*handle); | 
|  5664   } |  5667   } | 
|  5665 } |  5668 } | 
|  5666  |  5669  | 
|  5667 template<typename T> |  5670 template<typename T> | 
|  5668 template<typename S> |  5671 template<typename S> | 
|  5669 void ReturnValue<T>::Set(const Handle<S> handle) { |  5672 void ReturnValue<T>::Set(const Handle<S> handle) { | 
|  5670   TYPE_CHECK(T, S); |  5673   TYPE_CHECK(T, S); | 
|  5671   if (V8_UNLIKELY(handle.IsEmpty())) { |  5674   if (V8_UNLIKELY(handle.IsEmpty())) { | 
|  5672     SetUndefined(); |  5675     *value_ = GetDefaultValue(); | 
|  5673   } else { |  5676   } else { | 
|  5674     *value_ = *reinterpret_cast<internal::Object**>(*handle); |  5677     *value_ = *reinterpret_cast<internal::Object**>(*handle); | 
|  5675   } |  5678   } | 
|  5676 } |  5679 } | 
|  5677  |  5680  | 
|  5678 template<typename T> |  5681 template<typename T> | 
|  5679 void ReturnValue<T>::Set(double i) { |  5682 void ReturnValue<T>::Set(double i) { | 
|  5680   Set(Number::New(GetIsolate(), i)); |  5683   Set(Number::New(GetIsolate(), i)); | 
|  5681 } |  5684 } | 
|  5682  |  5685  | 
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  5721 } |  5724 } | 
|  5722  |  5725  | 
|  5723 template<typename T> |  5726 template<typename T> | 
|  5724 void ReturnValue<T>::SetUndefined() { |  5727 void ReturnValue<T>::SetUndefined() { | 
|  5725   typedef internal::Internals I; |  5728   typedef internal::Internals I; | 
|  5726   *value_ = *I::GetRoot(GetIsolate(), I::kUndefinedValueRootIndex); |  5729   *value_ = *I::GetRoot(GetIsolate(), I::kUndefinedValueRootIndex); | 
|  5727 } |  5730 } | 
|  5728  |  5731  | 
|  5729 template<typename T> |  5732 template<typename T> | 
|  5730 Isolate* ReturnValue<T>::GetIsolate() { |  5733 Isolate* ReturnValue<T>::GetIsolate() { | 
|  5731   // Isolate is always the pointer below value_ on the stack. |  5734   // Isolate is always the pointer below the default value on the stack. | 
|  5732   return *reinterpret_cast<Isolate**>(&value_[-1]); |  5735   return *reinterpret_cast<Isolate**>(&value_[-2]); | 
 |  5736 } | 
 |  5737  | 
 |  5738 template<typename T> | 
 |  5739 internal::Object* ReturnValue<T>::GetDefaultValue() { | 
 |  5740   // Default value is always the pointer below value_ on the stack. | 
 |  5741   return value_[-1]; | 
|  5733 } |  5742 } | 
|  5734  |  5743  | 
|  5735  |  5744  | 
|  5736 template<typename T> |  5745 template<typename T> | 
|  5737 FunctionCallbackInfo<T>::FunctionCallbackInfo(internal::Object** implicit_args, |  5746 FunctionCallbackInfo<T>::FunctionCallbackInfo(internal::Object** implicit_args, | 
|  5738                                               internal::Object** values, |  5747                                               internal::Object** values, | 
|  5739                                               int length, |  5748                                               int length, | 
|  5740                                               bool is_construct_call) |  5749                                               bool is_construct_call) | 
|  5741     : implicit_args_(implicit_args), |  5750     : implicit_args_(implicit_args), | 
|  5742       values_(values), |  5751       values_(values), | 
| (...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  6318  |  6327  | 
|  6319  |  6328  | 
|  6320 }  // namespace v8 |  6329 }  // namespace v8 | 
|  6321  |  6330  | 
|  6322  |  6331  | 
|  6323 #undef V8EXPORT |  6332 #undef V8EXPORT | 
|  6324 #undef TYPE_CHECK |  6333 #undef TYPE_CHECK | 
|  6325  |  6334  | 
|  6326  |  6335  | 
|  6327 #endif  // V8_H_ |  6336 #endif  // V8_H_ | 
| OLD | NEW |