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

Side by Side Diff: src/arguments.cc

Issue 1224623004: Make v8::Handle as "deprecated soon" (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 months 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
« no previous file with comments | « src/arguments.h ('k') | src/bootstrapper.h » ('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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/vm-state-inl.h" 8 #include "src/vm-state-inl.h"
9 9
10 namespace v8 { 10 namespace v8 {
11 namespace internal { 11 namespace internal {
12 12
13 13
14 template<typename T> 14 template <typename T>
15 template<typename V> 15 template <typename V>
16 v8::Handle<V> CustomArguments<T>::GetReturnValue(Isolate* isolate) { 16 v8::Local<V> CustomArguments<T>::GetReturnValue(Isolate* isolate) {
17 // Check the ReturnValue. 17 // Check the ReturnValue.
18 Object** handle = &this->begin()[kReturnValueOffset]; 18 Object** handle = &this->begin()[kReturnValueOffset];
19 // Nothing was set, return empty handle as per previous behaviour. 19 // Nothing was set, return empty handle as per previous behaviour.
20 if ((*handle)->IsTheHole()) return v8::Handle<V>(); 20 if ((*handle)->IsTheHole()) return v8::Local<V>();
21 return Utils::Convert<Object, V>(Handle<Object>(handle)); 21 return Utils::Convert<Object, V>(Handle<Object>(handle));
22 } 22 }
23 23
24 24
25 v8::Handle<v8::Value> FunctionCallbackArguments::Call(FunctionCallback f) { 25 v8::Local<v8::Value> FunctionCallbackArguments::Call(FunctionCallback f) {
26 Isolate* isolate = this->isolate(); 26 Isolate* isolate = this->isolate();
27 VMState<EXTERNAL> state(isolate); 27 VMState<EXTERNAL> state(isolate);
28 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); 28 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f));
29 FunctionCallbackInfo<v8::Value> info(begin(), 29 FunctionCallbackInfo<v8::Value> info(begin(),
30 argv_, 30 argv_,
31 argc_, 31 argc_,
32 is_construct_call_); 32 is_construct_call_);
33 f(info); 33 f(info);
34 return GetReturnValue<v8::Value>(isolate); 34 return GetReturnValue<v8::Value>(isolate);
35 } 35 }
36 36
37 37
38 #define WRITE_CALL_0(Function, ReturnValue) \ 38 #define WRITE_CALL_0(Function, ReturnValue) \
39 v8::Handle<ReturnValue> PropertyCallbackArguments::Call(Function f) { \ 39 v8::Local<ReturnValue> PropertyCallbackArguments::Call(Function f) { \
40 Isolate* isolate = this->isolate(); \ 40 Isolate* isolate = this->isolate(); \
41 VMState<EXTERNAL> state(isolate); \ 41 VMState<EXTERNAL> state(isolate); \
42 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); \ 42 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); \
43 PropertyCallbackInfo<ReturnValue> info(begin()); \ 43 PropertyCallbackInfo<ReturnValue> info(begin()); \
44 f(info); \ 44 f(info); \
45 return GetReturnValue<ReturnValue>(isolate); \ 45 return GetReturnValue<ReturnValue>(isolate); \
46 } 46 }
47 47
48 48
49 #define WRITE_CALL_1(Function, ReturnValue, Arg1) \ 49 #define WRITE_CALL_1(Function, ReturnValue, Arg1) \
50 v8::Handle<ReturnValue> PropertyCallbackArguments::Call(Function f, \ 50 v8::Local<ReturnValue> PropertyCallbackArguments::Call(Function f, \
51 Arg1 arg1) { \ 51 Arg1 arg1) { \
52 Isolate* isolate = this->isolate(); \ 52 Isolate* isolate = this->isolate(); \
53 VMState<EXTERNAL> state(isolate); \ 53 VMState<EXTERNAL> state(isolate); \
54 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); \ 54 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); \
55 PropertyCallbackInfo<ReturnValue> info(begin()); \ 55 PropertyCallbackInfo<ReturnValue> info(begin()); \
56 f(arg1, info); \ 56 f(arg1, info); \
57 return GetReturnValue<ReturnValue>(isolate); \ 57 return GetReturnValue<ReturnValue>(isolate); \
58 } 58 }
59 59
60 60
61 #define WRITE_CALL_2(Function, ReturnValue, Arg1, Arg2) \ 61 #define WRITE_CALL_2(Function, ReturnValue, Arg1, Arg2) \
62 v8::Handle<ReturnValue> PropertyCallbackArguments::Call(Function f, \ 62 v8::Local<ReturnValue> PropertyCallbackArguments::Call( \
63 Arg1 arg1, \ 63 Function f, Arg1 arg1, Arg2 arg2) { \
64 Arg2 arg2) { \ 64 Isolate* isolate = this->isolate(); \
65 Isolate* isolate = this->isolate(); \ 65 VMState<EXTERNAL> state(isolate); \
66 VMState<EXTERNAL> state(isolate); \ 66 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); \
67 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); \ 67 PropertyCallbackInfo<ReturnValue> info(begin()); \
68 PropertyCallbackInfo<ReturnValue> info(begin()); \ 68 f(arg1, arg2, info); \
69 f(arg1, arg2, info); \ 69 return GetReturnValue<ReturnValue>(isolate); \
70 return GetReturnValue<ReturnValue>(isolate); \ 70 }
71 }
72 71
73 72
74 #define WRITE_CALL_2_VOID(Function, ReturnValue, Arg1, Arg2) \ 73 #define WRITE_CALL_2_VOID(Function, ReturnValue, Arg1, Arg2) \
75 void PropertyCallbackArguments::Call(Function f, \ 74 void PropertyCallbackArguments::Call(Function f, \
76 Arg1 arg1, \ 75 Arg1 arg1, \
77 Arg2 arg2) { \ 76 Arg2 arg2) { \
78 Isolate* isolate = this->isolate(); \ 77 Isolate* isolate = this->isolate(); \
79 VMState<EXTERNAL> state(isolate); \ 78 VMState<EXTERNAL> state(isolate); \
80 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); \ 79 ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); \
81 PropertyCallbackInfo<ReturnValue> info(begin()); \ 80 PropertyCallbackInfo<ReturnValue> info(begin()); \
(...skipping 15 matching lines...) Expand all
97 double ClobberDoubleRegisters(double x1, double x2, double x3, double x4) { 96 double ClobberDoubleRegisters(double x1, double x2, double x3, double x4) {
98 // TODO(ulan): This clobbers only subset of registers depending on compiler, 97 // TODO(ulan): This clobbers only subset of registers depending on compiler,
99 // Rewrite this in assembly to really clobber all registers. 98 // Rewrite this in assembly to really clobber all registers.
100 // GCC for ia32 uses the FPU and does not touch XMM registers. 99 // GCC for ia32 uses the FPU and does not touch XMM registers.
101 return x1 * 1.01 + x2 * 2.02 + x3 * 3.03 + x4 * 4.04; 100 return x1 * 1.01 + x2 * 2.02 + x3 * 3.03 + x4 * 4.04;
102 } 101 }
103 102
104 103
105 } // namespace internal 104 } // namespace internal
106 } // namespace v8 105 } // namespace v8
OLDNEW
« no previous file with comments | « src/arguments.h ('k') | src/bootstrapper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698