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

Side by Side Diff: runtime/vm/intermediate_language.h

Issue 9559012: Adding Native Call node : a native function consists of that node, it does call into C runtime. In … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_ 5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_
6 #define VM_INTERMEDIATE_LANGUAGE_H_ 6 #define VM_INTERMEDIATE_LANGUAGE_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 #include "vm/ast.h"
9 #include "vm/growable_array.h" 10 #include "vm/growable_array.h"
10 #include "vm/handles_impl.h" 11 #include "vm/handles_impl.h"
11 #include "vm/object.h" 12 #include "vm/object.h"
12 13
13 namespace dart { 14 namespace dart {
14 15
15 class FlowGraphVisitor; 16 class FlowGraphVisitor;
16 class LocalVariable; 17 class LocalVariable;
18 class NativeBodyNode;
Kevin Millikin (Google) 2012/03/01 09:26:22 Do you want both the include of ast.h and the forw
srdjan 2012/03/01 17:25:42 Forgot to remove. Removed.
17 19
18 // Computations and values. 20 // Computations and values.
19 // 21 //
20 // <Computation> ::= <Value> 22 // <Computation> ::= <Value>
21 // | AssertAssignable <Value> <AbstractType> 23 // | AssertAssignable <Value> <AbstractType>
22 // | InstanceCall <cstring> <Value> ... 24 // | InstanceCall <cstring> <Value> ...
23 // | StaticCall <Function> <Value> ... 25 // | StaticCall <Function> <Value> ...
24 // | LoadLocal <LocalVariable> 26 // | LoadLocal <LocalVariable>
25 // | StoreLocal <LocalVariable> <Value> 27 // | StoreLocal <LocalVariable> <Value>
26 // | StrictCompare <Token::kind> <Value> <Value> 28 // | StrictCompare <Token::kind> <Value> <Value>
29 // | NativeCall <String> <NativeFunction> <int> <bool>
27 // 30 //
28 // <Value> ::= Temp <int> 31 // <Value> ::= Temp <int>
29 // | Constant <Instance> 32 // | Constant <Instance>
30 33
31 // M is a two argument macro. It is applied to each concrete value's 34 // M is a two argument macro. It is applied to each concrete value's
32 // typename and classname. 35 // typename and classname.
33 #define FOR_EACH_VALUE(M) \ 36 #define FOR_EACH_VALUE(M) \
34 M(Temp, TempVal) \ 37 M(Temp, TempVal) \
35 M(Constant, ConstantVal) 38 M(Constant, ConstantVal)
36 39
37 // M is a two argument macro. It is applied to each concrete instruction's 40 // M is a two argument macro. It is applied to each concrete instruction's
38 // (including the values) typename and classname. 41 // (including the values) typename and classname.
39 #define FOR_EACH_COMPUTATION(M) \ 42 #define FOR_EACH_COMPUTATION(M) \
40 FOR_EACH_VALUE(M) \ 43 FOR_EACH_VALUE(M) \
41 M(AssertAssignable, AssertAssignableComp) \ 44 M(AssertAssignable, AssertAssignableComp) \
42 M(InstanceCall, InstanceCallComp) \ 45 M(InstanceCall, InstanceCallComp) \
43 M(StrictCompare, StrictCompareComp) \
44 M(StaticCall, StaticCallComp) \ 46 M(StaticCall, StaticCallComp) \
45 M(LoadLocal, LoadLocalComp) \ 47 M(LoadLocal, LoadLocalComp) \
46 M(StoreLocal, StoreLocalComp) 48 M(StoreLocal, StoreLocalComp) \
49 M(StrictCompare, StrictCompareComp) \
50 M(NativeCall, NativeCallComp) \
47 51
48 52
49 #define FORWARD_DECLARATION(ShortName, ClassName) class ClassName; 53 #define FORWARD_DECLARATION(ShortName, ClassName) class ClassName;
50 FOR_EACH_COMPUTATION(FORWARD_DECLARATION) 54 FOR_EACH_COMPUTATION(FORWARD_DECLARATION)
51 #undef FORWARD_DECLARATION 55 #undef FORWARD_DECLARATION
52 56
53 class Computation : public ZoneAllocated { 57 class Computation : public ZoneAllocated {
54 public: 58 public:
55 Computation() { } 59 Computation() { }
56 60
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 const LocalVariable& local() const { return local_; } 233 const LocalVariable& local() const { return local_; }
230 Value* value() const { return value_; } 234 Value* value() const { return value_; }
231 235
232 private: 236 private:
233 const LocalVariable& local_; 237 const LocalVariable& local_;
234 Value* value_; 238 Value* value_;
235 239
236 DISALLOW_COPY_AND_ASSIGN(StoreLocalComp); 240 DISALLOW_COPY_AND_ASSIGN(StoreLocalComp);
237 }; 241 };
238 242
243
244 class NativeCallComp : public Computation {
245 public:
246 explicit NativeCallComp(NativeBodyNode* node) : ast_node_(*node) {}
Kevin Millikin (Google) 2012/03/01 09:26:22 I think this is fine to store the AST node and for
247
248 DECLARE_COMPUTATION(NativeCall)
249
250 const String& native_name() const {
251 return ast_node_.native_c_function_name();
252 }
253
254 private:
255 const NativeBodyNode& ast_node_;
256
257 DISALLOW_COPY_AND_ASSIGN(NativeCallComp);
258 };
259
239 #undef DECLARE_COMPUTATION 260 #undef DECLARE_COMPUTATION
240 261
241 262
242 // Instructions. 263 // Instructions.
243 // 264 //
244 // <Instruction> ::= Do <Computation> <Instruction> 265 // <Instruction> ::= Do <Computation> <Instruction>
245 // | Bind <int> <Computation> <Instruction> 266 // | Bind <int> <Computation> <Instruction>
246 // | Return <Value> 267 // | Return <Value>
247 // | Branch <Value> <Instruction> <Instruction> 268 // | Branch <Value> <Instruction> <Instruction>
248 // | Empty <Instruction> 269 // | Empty <Instruction>
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 #undef DECLARE_VISIT_INSTRUCTION 528 #undef DECLARE_VISIT_INSTRUCTION
508 529
509 private: 530 private:
510 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 531 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
511 }; 532 };
512 533
513 534
514 } // namespace dart 535 } // namespace dart
515 536
516 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 537 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« runtime/vm/flow_graph_builder.cc ('K') | « runtime/vm/flow_graph_compiler_x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698