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

Side by Side Diff: include/v8.h

Issue 119013004: Revert "More API cleanup." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/api.cc » ('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 // 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 1650 matching lines...) Expand 10 before | Expand all | Expand 10 after
1661 int options = NO_OPTIONS) const; 1661 int options = NO_OPTIONS) const;
1662 // UTF-8 encoded characters. 1662 // UTF-8 encoded characters.
1663 int WriteUtf8(char* buffer, 1663 int WriteUtf8(char* buffer,
1664 int length = -1, 1664 int length = -1,
1665 int* nchars_ref = NULL, 1665 int* nchars_ref = NULL,
1666 int options = NO_OPTIONS) const; 1666 int options = NO_OPTIONS) const;
1667 1667
1668 /** 1668 /**
1669 * A zero length string. 1669 * A zero length string.
1670 */ 1670 */
1671 static v8::Local<v8::String> Empty();
1671 V8_INLINE static v8::Local<v8::String> Empty(Isolate* isolate); 1672 V8_INLINE static v8::Local<v8::String> Empty(Isolate* isolate);
1672 1673
1673 /** 1674 /**
1674 * Returns true if the string is external 1675 * Returns true if the string is external
1675 */ 1676 */
1676 bool IsExternal() const; 1677 bool IsExternal() const;
1677 1678
1678 /** 1679 /**
1679 * Returns true if the string is both external and ASCII 1680 * Returns true if the string is both external and ASCII
1680 */ 1681 */
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
1955 }; 1956 };
1956 1957
1957 1958
1958 /** 1959 /**
1959 * A JavaScript number value (ECMA-262, 4.3.20) 1960 * A JavaScript number value (ECMA-262, 4.3.20)
1960 */ 1961 */
1961 class V8_EXPORT Number : public Primitive { 1962 class V8_EXPORT Number : public Primitive {
1962 public: 1963 public:
1963 double Value() const; 1964 double Value() const;
1964 static Local<Number> New(Isolate* isolate, double value); 1965 static Local<Number> New(Isolate* isolate, double value);
1966 // Will be deprecated soon.
1967 static Local<Number> New(double value);
1965 V8_INLINE static Number* Cast(v8::Value* obj); 1968 V8_INLINE static Number* Cast(v8::Value* obj);
1966 private: 1969 private:
1967 Number(); 1970 Number();
1968 static void CheckCast(v8::Value* obj); 1971 static void CheckCast(v8::Value* obj);
1969 }; 1972 };
1970 1973
1971 1974
1972 /** 1975 /**
1973 * A JavaScript value representing a signed integer. 1976 * A JavaScript value representing a signed integer.
1974 */ 1977 */
1975 class V8_EXPORT Integer : public Number { 1978 class V8_EXPORT Integer : public Number {
1976 public: 1979 public:
1977 static Local<Integer> New(Isolate* isolate, int32_t value); 1980 static Local<Integer> New(Isolate* isolate, int32_t value);
1978 static Local<Integer> NewFromUnsigned(Isolate* isolate, uint32_t value); 1981 static Local<Integer> NewFromUnsigned(Isolate* isolate, uint32_t value);
1982 // Will be deprecated soon.
1983 static Local<Integer> New(int32_t value, Isolate*);
1984 static Local<Integer> NewFromUnsigned(uint32_t value, Isolate*);
1985 static Local<Integer> New(int32_t value);
1986 static Local<Integer> NewFromUnsigned(uint32_t value);
1979 int64_t Value() const; 1987 int64_t Value() const;
1980 V8_INLINE static Integer* Cast(v8::Value* obj); 1988 V8_INLINE static Integer* Cast(v8::Value* obj);
1981 private: 1989 private:
1982 Integer(); 1990 Integer();
1983 static void CheckCast(v8::Value* obj); 1991 static void CheckCast(v8::Value* obj);
1984 }; 1992 };
1985 1993
1986 1994
1987 /** 1995 /**
1988 * A JavaScript value representing a 32-bit signed integer. 1996 * A JavaScript value representing a 32-bit signed integer.
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
2322 Handle<Value> argv[]); 2330 Handle<Value> argv[]);
2323 2331
2324 /** 2332 /**
2325 * Call an Object as a constructor if a callback is set by the 2333 * Call an Object as a constructor if a callback is set by the
2326 * ObjectTemplate::SetCallAsFunctionHandler method. 2334 * ObjectTemplate::SetCallAsFunctionHandler method.
2327 * Note: This method behaves like the Function::NewInstance method. 2335 * Note: This method behaves like the Function::NewInstance method.
2328 */ 2336 */
2329 Local<Value> CallAsConstructor(int argc, Handle<Value> argv[]); 2337 Local<Value> CallAsConstructor(int argc, Handle<Value> argv[]);
2330 2338
2331 static Local<Object> New(Isolate* isolate); 2339 static Local<Object> New(Isolate* isolate);
2332 2340 // Will be deprecated soon.
2341 static Local<Object> New();
2333 V8_INLINE static Object* Cast(Value* obj); 2342 V8_INLINE static Object* Cast(Value* obj);
2334 2343
2335 private: 2344 private:
2336 Object(); 2345 Object();
2337 static void CheckCast(Value* obj); 2346 static void CheckCast(Value* obj);
2338 Local<Value> SlowGetInternalField(int index); 2347 Local<Value> SlowGetInternalField(int index);
2339 void* SlowGetAlignedPointerFromInternalField(int index); 2348 void* SlowGetAlignedPointerFromInternalField(int index);
2340 }; 2349 };
2341 2350
2342 2351
(...skipping 988 matching lines...) Expand 10 before | Expand all | Expand 10 after
3331 */ 3340 */
3332 class V8_EXPORT FunctionTemplate : public Template { 3341 class V8_EXPORT FunctionTemplate : public Template {
3333 public: 3342 public:
3334 /** Creates a function template.*/ 3343 /** Creates a function template.*/
3335 static Local<FunctionTemplate> New( 3344 static Local<FunctionTemplate> New(
3336 Isolate* isolate, 3345 Isolate* isolate,
3337 FunctionCallback callback = 0, 3346 FunctionCallback callback = 0,
3338 Handle<Value> data = Handle<Value>(), 3347 Handle<Value> data = Handle<Value>(),
3339 Handle<Signature> signature = Handle<Signature>(), 3348 Handle<Signature> signature = Handle<Signature>(),
3340 int length = 0); 3349 int length = 0);
3350 // Will be deprecated soon.
3351 static Local<FunctionTemplate> New(
3352 FunctionCallback callback = 0,
3353 Handle<Value> data = Handle<Value>(),
3354 Handle<Signature> signature = Handle<Signature>(),
3355 int length = 0);
3341 3356
3342 /** Returns the unique function instance in the current execution context.*/ 3357 /** Returns the unique function instance in the current execution context.*/
3343 Local<Function> GetFunction(); 3358 Local<Function> GetFunction();
3344 3359
3345 /** 3360 /**
3346 * Set the call-handler callback for a FunctionTemplate. This 3361 * Set the call-handler callback for a FunctionTemplate. This
3347 * callback is called whenever the function created from this 3362 * callback is called whenever the function created from this
3348 * FunctionTemplate is called. 3363 * FunctionTemplate is called.
3349 */ 3364 */
3350 void SetCallHandler(FunctionCallback callback, 3365 void SetCallHandler(FunctionCallback callback,
(...skipping 2419 matching lines...) Expand 10 before | Expand all | Expand 10 after
5770 } 5785 }
5771 5786
5772 template<typename T> 5787 template<typename T>
5773 void ReturnValue<T>::Set(int32_t i) { 5788 void ReturnValue<T>::Set(int32_t i) {
5774 TYPE_CHECK(T, Integer); 5789 TYPE_CHECK(T, Integer);
5775 typedef internal::Internals I; 5790 typedef internal::Internals I;
5776 if (V8_LIKELY(I::IsValidSmi(i))) { 5791 if (V8_LIKELY(I::IsValidSmi(i))) {
5777 *value_ = I::IntToSmi(i); 5792 *value_ = I::IntToSmi(i);
5778 return; 5793 return;
5779 } 5794 }
5780 Set(Integer::New(GetIsolate(), i)); 5795 Set(Integer::New(i, GetIsolate()));
5781 } 5796 }
5782 5797
5783 template<typename T> 5798 template<typename T>
5784 void ReturnValue<T>::Set(uint32_t i) { 5799 void ReturnValue<T>::Set(uint32_t i) {
5785 TYPE_CHECK(T, Integer); 5800 TYPE_CHECK(T, Integer);
5786 // Can't simply use INT32_MAX here for whatever reason. 5801 // Can't simply use INT32_MAX here for whatever reason.
5787 bool fits_into_int32_t = (i & (1U << 31)) == 0; 5802 bool fits_into_int32_t = (i & (1U << 31)) == 0;
5788 if (V8_LIKELY(fits_into_int32_t)) { 5803 if (V8_LIKELY(fits_into_int32_t)) {
5789 Set(static_cast<int32_t>(i)); 5804 Set(static_cast<int32_t>(i));
5790 return; 5805 return;
5791 } 5806 }
5792 Set(Integer::NewFromUnsigned(GetIsolate(), i)); 5807 Set(Integer::NewFromUnsigned(i, GetIsolate()));
5793 } 5808 }
5794 5809
5795 template<typename T> 5810 template<typename T>
5796 void ReturnValue<T>::Set(bool value) { 5811 void ReturnValue<T>::Set(bool value) {
5797 TYPE_CHECK(T, Boolean); 5812 TYPE_CHECK(T, Boolean);
5798 typedef internal::Internals I; 5813 typedef internal::Internals I;
5799 int root_index; 5814 int root_index;
5800 if (value) { 5815 if (value) {
5801 root_index = I::kTrueValueRootIndex; 5816 root_index = I::kTrueValueRootIndex;
5802 } else { 5817 } else {
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after
6440 */ 6455 */
6441 6456
6442 6457
6443 } // namespace v8 6458 } // namespace v8
6444 6459
6445 6460
6446 #undef TYPE_CHECK 6461 #undef TYPE_CHECK
6447 6462
6448 6463
6449 #endif // V8_H_ 6464 #endif // V8_H_
OLDNEW
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698