FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
android_external_webkit/JavaScriptCore/parser/Nodes.h at froyo · madmack/android_external_webkit · GitHub
madmack
/
android_external_webkit
Public
forked from
Y6b/android_external_webkit
Notifications
You must be signed in to change notification settings
Fork
0
Star
2
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
android_external_webkit
/
JavaScriptCore
/
parser
/
Nodes.h
Copy path
More file actions
More file actions
Latest commit
History
History
History
1599 lines (1207 loc) · 52.3 KB
Breadcrumbs
android_external_webkit
/
JavaScriptCore
/
parser
/
Nodes.h
Copy path
File metadata and controls
1599 lines (1207 loc) · 52.3 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
* Copyright (C) 2001 Peter Kelly (pmk@post.com)
* Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
* Copyright (C) 2007 Cameron Zwarich (cwzwarich@uwaterloo.ca)
* Copyright (C) 2007 Maks Orlovich
* Copyright (C) 2007 Eric Seidel <eric@webkit.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
*/
#
ifndef
Nodes_h
#
define
Nodes_h
#
include
"
Error.h
"
#
include
"
JITCode.h
"
#
include
"
Opcode.h
"
#
include
"
ParserArena.h
"
#
include
"
ResultType.h
"
#
include
"
SourceCode.h
"
#
include
"
SymbolTable.h
"
#
include
<
wtf/MathExtras.h
>
namespace
JSC
{
class
ArgumentListNode
;
class
BytecodeGenerator
;
class
FunctionBodyNode
;
class
Label
;
class
PropertyListNode
;
class
ReadModifyResolveNode
;
class
RegisterID
;
class
ScopeChainNode
;
class
ScopeNode
;
typedef
unsigned
CodeFeatures;
const
CodeFeatures NoFeatures =
0
;
const
CodeFeatures EvalFeature =
1
<<
0
;
const
CodeFeatures ClosureFeature =
1
<<
1
;
const
CodeFeatures AssignFeature =
1
<<
2
;
const
CodeFeatures ArgumentsFeature =
1
<<
3
;
const
CodeFeatures WithFeature =
1
<<
4
;
const
CodeFeatures CatchFeature =
1
<<
5
;
const
CodeFeatures ThisFeature =
1
<<
6
;
const
CodeFeatures AllFeatures = EvalFeature | ClosureFeature | AssignFeature | ArgumentsFeature | WithFeature | CatchFeature | ThisFeature;
enum
Operator {
OpEqual,
OpPlusEq,
OpMinusEq,
OpMultEq,
OpDivEq,
OpPlusPlus,
OpMinusMinus,
OpAndEq,
OpXOrEq,
OpOrEq,
OpModEq,
OpLShift,
OpRShift,
OpURShift
};
enum
LogicalOperator {
OpLogicalAnd,
OpLogicalOr
};
namespace
DeclarationStacks
{
enum
VarAttrs { IsConstant =
1
, HasInitializer =
2
};
typedef
Vector<std::pair<
const
Identifier*,
unsigned
> > VarStack;
typedef
Vector<FunctionBodyNode*> FunctionStack;
}
struct
SwitchInfo
{
enum
SwitchType { SwitchNone, SwitchImmediate, SwitchCharacter, SwitchString };
uint32_t
bytecodeOffset;
SwitchType switchType;
};
class
ParserArenaFreeable
{
public:
//
ParserArenaFreeable objects are are freed when the arena is deleted.
//
Destructors are not called. Clients must not call delete on such objects.
void
*
operator
new
(
size_t
, JSGlobalData*);
};
class
ParserArenaDeletable
{
public:
virtual
~ParserArenaDeletable
() { }
//
ParserArenaDeletable objects are deleted when the arena is deleted.
//
Clients must not call delete directly on such objects.
void
*
operator
new
(
size_t
, JSGlobalData*);
};
class
ParserArenaRefCounted
:
public
RefCounted
<ParserArenaRefCounted> {
protected:
ParserArenaRefCounted
(JSGlobalData*);
public:
virtual
~ParserArenaRefCounted
()
{
ASSERT
(
deletionHasBegun
());
}
};
class
Node
:
public
ParserArenaFreeable
{
protected:
Node
(JSGlobalData*);
public:
virtual
~Node
() { }
virtual
RegisterID*
emitBytecode
(BytecodeGenerator&, RegisterID* destination =
0
) = 0;
int
lineNo
()
const
{
return
m_line; }
protected:
int
m_line;
};
class
ExpressionNode
:
public
Node
{
protected:
ExpressionNode
(JSGlobalData*, ResultType = ResultType::unknownType());
public:
virtual
bool
isNumber
()
const
{
return
false
; }
virtual
bool
isString
()
const
{
return
false
; }
virtual
bool
isNull
()
const
{
return
false
; }
virtual
bool
isPure
(BytecodeGenerator&)
const
{
return
false
; }
virtual
bool
isLocation
()
const
{
return
false
; }
virtual
bool
isResolveNode
()
const
{
return
false
; }
virtual
bool
isBracketAccessorNode
()
const
{
return
false
; }
virtual
bool
isDotAccessorNode
()
const
{
return
false
; }
virtual
bool
isFuncExprNode
()
const
{
return
false
; }
virtual
bool
isCommaNode
()
const
{
return
false
; }
virtual
bool
isSimpleArray
()
const
{
return
false
; }
virtual
bool
isAdd
()
const
{
return
false
; }
virtual
bool
hasConditionContextCodegen
()
const
{
return
false
; }
virtual
void
emitBytecodeInConditionContext
(BytecodeGenerator&, Label*, Label*,
bool
) {
ASSERT_NOT_REACHED
(); }
virtual
ExpressionNode*
stripUnaryPlus
() {
return
this
; }
ResultType
resultDescriptor
()
const
{
return
m_resultType; }
private:
ResultType m_resultType;
};
class
StatementNode
:
public
Node
{
protected:
StatementNode
(JSGlobalData*);
public:
void
setLoc
(
int
firstLine,
int
lastLine);
int
firstLine
()
const
{
return
lineNo
(); }
int
lastLine
()
const
{
return
m_lastLine; }
virtual
bool
isEmptyStatement
()
const
{
return
false
; }
virtual
bool
isReturnNode
()
const
{
return
false
; }
virtual
bool
isExprStatement
()
const
{
return
false
; }
virtual
bool
isBlock
()
const
{
return
false
; }
private:
int
m_lastLine;
};
class
NullNode
:
public
ExpressionNode
{
public:
NullNode
(JSGlobalData*);
private:
virtual
RegisterID*
emitBytecode
(BytecodeGenerator&, RegisterID* =
0
);
virtual
bool
isNull
()
const
{
return
true
; }
};
class
BooleanNode
:
public
ExpressionNode
{
public:
BooleanNode
(JSGlobalData*,
bool
value);
private:
virtual
RegisterID*
emitBytecode
(BytecodeGenerator&, RegisterID* =
0
);
virtual
bool
isPure
(BytecodeGenerator&)
const
{
return
true
; }
bool
m_value;
};
class
NumberNode
:
public
ExpressionNode
{
public:
NumberNode
(JSGlobalData*,
double
value);
double
value
()
const
{
return
m_value; }
void
setValue
(
double
value) { m_value = value; }
private:
virtual
RegisterID*
emitBytecode
(BytecodeGenerator&, RegisterID* =
0
);
virtual
bool
isNumber
()
const
{
return
true
; }
virtual
bool
isPure
(BytecodeGenerator&)
const
{
return
true
; }
double
m_value;
};
class
StringNode
:
public
ExpressionNode
{
public:
StringNode
(JSGlobalData*,
const
Identifier&);
const
Identifier&
value
() {
return
m_value; }
private:
virtual
bool
isPure
(BytecodeGenerator&)
const
{
return
true
; }
virtual
RegisterID*
emitBytecode
(BytecodeGenerator&, RegisterID* =
0
);
virtual
bool
isString
()
const
{
return
true
; }
const
Identifier& m_value;
};
class
ThrowableExpressionData
{
public:
ThrowableExpressionData
()
: m_divot(
static_cast
<
uint32_t
>(-
1
))
, m_startOffset(
static_cast
<
uint16_t
>(-
1
))
, m_endOffset(
static_cast
<
uint16_t
>(-
1
))
{
}
ThrowableExpressionData
(
unsigned
divot,
unsigned
startOffset,
unsigned
endOffset)
: m_divot(divot)
, m_startOffset(startOffset)
, m_endOffset(endOffset)
{
}
void
setExceptionSourceCode
(
unsigned
divot,
unsigned
startOffset,
unsigned
endOffset)
{
m_divot = divot;
m_startOffset = startOffset;
m_endOffset = endOffset;
}
uint32_t
divot
()
const
{
return
m_divot; }
uint16_t
startOffset
()
const
{
return
m_startOffset; }
uint16_t
endOffset
()
const
{
return
m_endOffset; }
protected:
RegisterID*
emitThrowError
(BytecodeGenerator&, ErrorType,
const
char
* message);
RegisterID*
emitThrowError
(BytecodeGenerator&, ErrorType,
const
char
* message,
const
UString&);
RegisterID*
emitThrowError
(BytecodeGenerator&, ErrorType,
const
char
* message,
const
Identifier&);
private:
uint32_t
m_divot;
uint16_t
m_startOffset;
uint16_t
m_endOffset;
};
class
ThrowableSubExpressionData
:
public
ThrowableExpressionData
{
public:
ThrowableSubExpressionData
()
: m_subexpressionDivotOffset(
0
)
, m_subexpressionEndOffset(
0
)
{
}
ThrowableSubExpressionData
(
unsigned
divot,
unsigned
startOffset,
unsigned
endOffset)
: ThrowableExpressionData(divot, startOffset, endOffset)
, m_subexpressionDivotOffset(
0
)
, m_subexpressionEndOffset(
0
)
{
}
void
setSubexpressionInfo
(
uint32_t
subexpressionDivot,
uint16_t
subexpressionOffset)
{
ASSERT
(subexpressionDivot <=
divot
());
if
((
divot
() - subexpressionDivot) & ~
0xFFFF
)
//
Overflow means we can't do this safely, so just point at the primary divot
return
;
m_subexpressionDivotOffset =
divot
() - subexpressionDivot;
m_subexpressionEndOffset = subexpressionOffset;
}
protected:
uint16_t
m_subexpressionDivotOffset;
uint16_t
m_subexpressionEndOffset;
};
class
ThrowablePrefixedSubExpressionData
:
public
ThrowableExpressionData
{
public:
ThrowablePrefixedSubExpressionData
()
: m_subexpressionDivotOffset(
0
)
, m_subexpressionStartOffset(
0
)
{
}
ThrowablePrefixedSubExpressionData
(
unsigned
divot,
unsigned
startOffset,
unsigned
endOffset)
: ThrowableExpressionData(divot, startOffset, endOffset)
, m_subexpressionDivotOffset(
0
)
, m_subexpressionStartOffset(
0
)
{
}
void
setSubexpressionInfo
(
uint32_t
subexpressionDivot,
uint16_t
subexpressionOffset)
{
ASSERT
(subexpressionDivot >=
divot
());
if
((subexpressionDivot -
divot
()) & ~
0xFFFF
)
//
Overflow means we can't do this safely, so just point at the primary divot
return
;
m_subexpressionDivotOffset = subexpressionDivot -
divot
();
m_subexpressionStartOffset = subexpressionOffset;
}
protected:
uint16_t
m_subexpressionDivotOffset;
uint16_t
m_subexpressionStartOffset;
};
class
RegExpNode
:
public
ExpressionNode
,
public
ThrowableExpressionData
{
public:
RegExpNode
(JSGlobalData*,
const
Identifier& pattern,
const
Identifier& flags);
private:
virtual
RegisterID*
emitBytecode
(BytecodeGenerator&, RegisterID* =
0
);
const
Identifier& m_pattern;
const
Identifier& m_flags;
};
class
ThisNode
:
public
ExpressionNode
{
public:
ThisNode
(JSGlobalData*);
private:
virtual
RegisterID*
emitBytecode
(BytecodeGenerator&, RegisterID* =
0
);
};
class
ResolveNode
:
public
ExpressionNode
{
public:
ResolveNode
(JSGlobalData*,
const
Identifier&,
int
startOffset);
const
Identifier&
identifier
()
const
{
return
m_ident; }
private:
virtual
RegisterID*
emitBytecode
(BytecodeGenerator&, RegisterID* =
0
);
virtual
bool
isPure
(BytecodeGenerator&)
const
;
virtual
bool
isLocation
()
const
{
return
true
; }
virtual
bool
isResolveNode
()
const
{
return
true
; }
const
Identifier& m_ident;
int32_t
m_startOffset;
};
class
ElementNode
:
public
ParserArenaFreeable
{
public:
ElementNode
(JSGlobalData*,
int
elision, ExpressionNode*);
ElementNode
(JSGlobalData*, ElementNode*,
int
elision, ExpressionNode*);
int
elision
()
const
{
return
m_elision; }
ExpressionNode*
value
() {
return
m_node; }
ElementNode*
next
() {
return
m_next; }
private:
ElementNode* m_next;
int
m_elision;
ExpressionNode* m_node;
};
class
ArrayNode
:
public
ExpressionNode
{
public:
ArrayNode
(JSGlobalData*,
int
elision);
ArrayNode
(JSGlobalData*, ElementNode*);
ArrayNode
(JSGlobalData*,
int
elision, ElementNode*);
ArgumentListNode*
toArgumentList
(JSGlobalData*)
const
;
private:
virtual
RegisterID*
emitBytecode
(BytecodeGenerator&, RegisterID* =
0
);
virtual
bool
isSimpleArray
()
const
;
ElementNode* m_element;
int
m_elision;
bool
m_optional;
};
class
PropertyNode
:
public
ParserArenaFreeable
{
public:
enum
Type { Constant, Getter, Setter };
PropertyNode
(JSGlobalData*,
const
Identifier& name, ExpressionNode* value, Type);
PropertyNode
(JSGlobalData*,
double
name, ExpressionNode* value, Type);
const
Identifier&
name
()
const
{
return
m_name; }
private:
friend
class
PropertyListNode
;
const
Identifier& m_name;
ExpressionNode* m_assign;
Type m_type;
};
class
PropertyListNode
:
public
Node
{
public:
PropertyListNode
(JSGlobalData*, PropertyNode*);
PropertyListNode
(JSGlobalData*, PropertyNode*, PropertyListNode*);
virtual
RegisterID*
emitBytecode
(BytecodeGenerator&, RegisterID* =
0
);
private:
PropertyNode* m_node;
PropertyListNode* m_next;
};
class
ObjectLiteralNode
:
public
ExpressionNode
{
public:
ObjectLiteralNode
(JSGlobalData*);
ObjectLiteralNode
(JSGlobalData*, PropertyListNode*);
private:
virtual
RegisterID*
emitBytecode
(BytecodeGenerator&, RegisterID* =
0
);
PropertyListNode* m_list;
};
class
BracketAccessorNode
:
public
ExpressionNode
,
public
ThrowableExpressionData
{
public:
BracketAccessorNode
(JSGlobalData*, ExpressionNode* base, ExpressionNode* subscript,
bool
subscriptHasAssignments);
ExpressionNode*
base
()
const
{
return
m_base; }
ExpressionNode*
subscript
()
const
{
return
m_subscript; }
private:
virtual
RegisterID*
emitBytecode
(BytecodeGenerator&, RegisterID* =
0
);
virtual
bool
isLocation
()
const
{
return
true
; }
virtual
bool
isBracketAccessorNode
()
const
{
return
true
; }
ExpressionNode* m_base;
ExpressionNode* m_subscript;
bool
m_subscriptHasAssignments;
};
class
DotAccessorNode
:
public
ExpressionNode
,
public
ThrowableExpressionData
{
public:
DotAccessorNode
(JSGlobalData*, ExpressionNode* base,
const
Identifier&);
ExpressionNode*
base
()
const
{
return
m_base; }
const
Identifier&
identifier
()
const
{
return
m_ident; }
private:
virtual
RegisterID*
emitBytecode
(BytecodeGenerator&, RegisterID* =
0
);
virtual
bool
isLocation
()
const
{
return
true
; }
virtual
bool
isDotAccessorNode
()
const
{
return
true
; }
ExpressionNode* m_base;
const
Identifier& m_ident;
};
class
ArgumentListNode
:
public
Node
{
public:
ArgumentListNode
(JSGlobalData*, ExpressionNode*);
ArgumentListNode
(JSGlobalData*, ArgumentListNode*, ExpressionNode*);
ArgumentListNode* m_next;
ExpressionNode* m_expr;
private:
virtual
RegisterID*
emitBytecode
(BytecodeGenerator&, RegisterID* =
0
);
};
class
ArgumentsNode
:
public
ParserArenaFreeable
{
public:
ArgumentsNode
(JSGlobalData*);
ArgumentsNode
(JSGlobalData*, ArgumentListNode*);
ArgumentListNode* m_listNode;
};
class
NewExprNode
:
public
ExpressionNode
,
public
ThrowableExpressionData
{
public:
NewExprNode
(JSGlobalData*, ExpressionNode*);
NewExprNode
(JSGlobalData*, ExpressionNode*, ArgumentsNode*);
private:
virtual
RegisterID*
emitBytecode
(BytecodeGenerator&, RegisterID* =
0
);
ExpressionNode* m_expr;
ArgumentsNode* m_args;
};
class
EvalFunctionCallNode
:
public
ExpressionNode
,
public
ThrowableExpressionData
{
public:
EvalFunctionCallNode
(JSGlobalData*, ArgumentsNode*,
unsigned
divot,
unsigned
startOffset,
unsigned
endOffset);
private:
virtual
RegisterID*
emitBytecode
(BytecodeGenerator&, RegisterID* =
0
);
ArgumentsNode* m_args;
};
class
FunctionCallValueNode
:
public
ExpressionNode
,
public
ThrowableExpressionData
{
public:
FunctionCallValueNode
(JSGlobalData*, ExpressionNode*, ArgumentsNode*,
unsigned
divot,
unsigned
startOffset,
unsigned
endOffset);
private:
virtual
RegisterID*
emitBytecode
(BytecodeGenerator&, RegisterID* =
0
);
ExpressionNode* m_expr;
ArgumentsNode* m_args;
};
class
FunctionCallResolveNode
:
public
ExpressionNode
,
public
ThrowableExpressionData
{
public:
FunctionCallResolveNode
(JSGlobalData*,
const
Identifier&, ArgumentsNode*,
unsigned
divot,
unsigned
startOffset,
unsigned
endOffset);
private:
virtual
RegisterID*
emitBytecode
(BytecodeGenerator&, RegisterID* =
0
);
const
Identifier& m_ident;
ArgumentsNode* m_args;
size_t
m_index;
//
Used by LocalVarFunctionCallNode.
size_t
m_scopeDepth;
//
Used by ScopedVarFunctionCallNode and NonLocalVarFunctionCallNode
};
class
FunctionCallBracketNode
:
public
ExpressionNode
,
public
ThrowableSubExpressionData
{
public:
FunctionCallBracketNode
(JSGlobalData*, ExpressionNode* base, ExpressionNode* subscript, ArgumentsNode*,
unsigned
divot,
unsigned
startOffset,
unsigned
endOffset);
private:
virtual
RegisterID*
emitBytecode
(BytecodeGenerator&, RegisterID* =
0
);
ExpressionNode* m_base;
ExpressionNode* m_subscript;
ArgumentsNode* m_args;
};
class
FunctionCallDotNode
:
public
ExpressionNode
,
public
ThrowableSubExpressionData
{
public:
FunctionCallDotNode
(JSGlobalData*, ExpressionNode* base,
const
Identifier&, ArgumentsNode*,
unsigned
divot,
unsigned
startOffset,
unsigned
endOffset);
private:
virtual
RegisterID*
emitBytecode
(BytecodeGenerator&, RegisterID* =
0
);
protected:
ExpressionNode* m_base;
const
Identifier& m_ident;
ArgumentsNode* m_args;
};
class
CallFunctionCallDotNode
:
public
FunctionCallDotNode
{
public:
CallFunctionCallDotNode
(JSGlobalData*, ExpressionNode* base,
const
Identifier&, ArgumentsNode*,
unsigned
divot,
unsigned
startOffset,
unsigned
endOffset);
private:
virtual
RegisterID*
emitBytecode
(BytecodeGenerator&, RegisterID* =
0
);
};
class
ApplyFunctionCallDotNode
:
public
FunctionCallDotNode
{
public:
ApplyFunctionCallDotNode
(JSGlobalData*, ExpressionNode* base,
const
Identifier&, ArgumentsNode*,
unsigned
divot,
unsigned
startOffset,
unsigned
endOffset);
private:
virtual
RegisterID*
emitBytecode
(BytecodeGenerator&, RegisterID* =
0
);
};
class
PrePostResolveNode
:
public
ExpressionNode
,
public
ThrowableExpressionData
{
public:
PrePostResolveNode
(JSGlobalData*,
const
Identifier&,
unsigned
divot,
unsigned
startOffset,
unsigned
endOffset);
protected:
const
Identifier& m_ident;
};
class
PostfixResolveNode
:
public
PrePostResolveNode
{
public:
PostfixResolveNode
(JSGlobalData*,
const
Identifier&, Operator,
unsigned
divot,
unsigned
startOffset,
unsigned
endOffset);
private:
virtual
RegisterID*
emitBytecode
(BytecodeGenerator&, RegisterID* =
0
);
Operator m_operator;
};
class
PostfixBracketNode
:
public
ExpressionNode
,
public
ThrowableSubExpressionData
{
public:
PostfixBracketNode
(JSGlobalData*, ExpressionNode* base, ExpressionNode* subscript, Operator,
unsigned
divot,
unsigned
startOffset,
unsigned
endOffset);
private:
virtual
RegisterID*
emitBytecode
(BytecodeGenerator&, RegisterID* =
0
);
ExpressionNode* m_base;
ExpressionNode* m_subscript;
Operator m_operator;
};
class
PostfixDotNode
:
public
ExpressionNode
,
public
ThrowableSubExpressionData
{
public:
PostfixDotNode
(JSGlobalData*, ExpressionNode* base,
const
Identifier&, Operator,
unsigned
divot,
unsigned
startOffset,
unsigned
endOffset);
private:
virtual
RegisterID*
emitBytecode
(BytecodeGenerator&, RegisterID* =
0
);
ExpressionNode* m_base;
const
Identifier& m_ident;
Operator m_operator;
};
class
PostfixErrorNode
:
public
ExpressionNode
,
public
ThrowableSubExpressionData
{
public:
PostfixErrorNode
(JSGlobalData*, ExpressionNode*, Operator,
unsigned
divot,
unsigned
startOffset,
unsigned
endOffset);
private:
virtual
RegisterID*
emitBytecode
(BytecodeGenerator&, RegisterID* =
0
);
ExpressionNode* m_expr;
Operator m_operator;
};
class
DeleteResolveNode
:
public
ExpressionNode
,
public
ThrowableExpressionData
{
public:
DeleteResolveNode
(JSGlobalData*,
const
Identifier&,
unsigned
divot,
unsigned
startOffset,
unsigned
endOffset);
private:
virtual
RegisterID*
emitBytecode
(BytecodeGenerator&, RegisterID* =
0
);
const
Identifier& m_ident;
};
class
DeleteBracketNode
:
public
ExpressionNode
,
public
ThrowableExpressionData
{
public:
DeleteBracketNode
(JSGlobalData*, ExpressionNode* base, ExpressionNode* subscript,
unsigned
divot,
unsigned
startOffset,
unsigned
endOffset);
private:
virtual
RegisterID*
emitBytecode
(BytecodeGenerator&, RegisterID* =
0
);
ExpressionNode* m_base;
ExpressionNode* m_subscript;
};
class
DeleteDotNode
:
public
ExpressionNode
,
public
ThrowableExpressionData
{
public:
DeleteDotNode
(JSGlobalData*, ExpressionNode* base,
const
Identifier&,
unsigned
divot,
unsigned
startOffset,
unsigned
endOffset);
private:
virtual
RegisterID*
emitBytecode
(BytecodeGenerator&, RegisterID* =
0
);
ExpressionNode* m_base;
const
Identifier& m_ident;
};
class
DeleteValueNode
:
public
ExpressionNode
{
public:
DeleteValueNode
(JSGlobalData*, ExpressionNode*);
private:
virtual
RegisterID*
emitBytecode
(BytecodeGenerator&, RegisterID* =
0
);
ExpressionNode* m_expr;
};
class
VoidNode
:
public
ExpressionNode
{
public:
VoidNode
(JSGlobalData*, ExpressionNode*);
private:
virtual
RegisterID*
emitBytecode
(BytecodeGenerator&, RegisterID* =
0
);
ExpressionNode* m_expr;
};
class
TypeOfResolveNode
:
public
ExpressionNode
{
public:
TypeOfResolveNode
(JSGlobalData*,
const
Identifier&);
const
Identifier&
identifier
()
const
{
return
m_ident; }
private:
virtual
RegisterID*
emitBytecode
(BytecodeGenerator&, RegisterID* =
0
);
const
Identifier& m_ident;
};
class
TypeOfValueNode
:
public
ExpressionNode
{
public:
TypeOfValueNode
(JSGlobalData*, ExpressionNode*);
private:
virtual
RegisterID*
emitBytecode
(BytecodeGenerator&, RegisterID* =
0
);
ExpressionNode* m_expr;
};
class
PrefixResolveNode
:
public
PrePostResolveNode
{
public:
PrefixResolveNode
(JSGlobalData*,
const
Identifier&, Operator,
unsigned
divot,
unsigned
startOffset,
unsigned
endOffset);
private:
virtual
RegisterID*
emitBytecode
(BytecodeGenerator&, RegisterID* =
0
);
Operator m_operator;
};
class
PrefixBracketNode
:
public
ExpressionNode
,
public
ThrowablePrefixedSubExpressionData
{
public:
PrefixBracketNode
(JSGlobalData*, ExpressionNode* base, ExpressionNode* subscript, Operator,
unsigned
divot,
unsigned
startOffset,
unsigned
endOffset);
private:
virtual
RegisterID*
emitBytecode
(BytecodeGenerator&, RegisterID* =
0
);
ExpressionNode* m_base;
ExpressionNode* m_subscript;
Operator m_operator;
};
class
PrefixDotNode
:
public
ExpressionNode
,
public
ThrowablePrefixedSubExpressionData
{
public:
PrefixDotNode
(JSGlobalData*, ExpressionNode* base,
const
Identifier&, Operator,
unsigned
divot,
unsigned
startOffset,
unsigned
endOffset);
private:
virtual
RegisterID*
emitBytecode
(BytecodeGenerator&, RegisterID* =
0
);
ExpressionNode* m_base;
const
Identifier& m_ident;
Operator m_operator;
};
class
PrefixErrorNode
:
public
ExpressionNode
,
public
ThrowableExpressionData
{
public:
PrefixErrorNode
(JSGlobalData*, ExpressionNode*, Operator,
unsigned
divot,
unsigned
startOffset,
unsigned
endOffset);
private:
virtual
RegisterID*
emitBytecode
(BytecodeGenerator&, RegisterID* =
0
);
ExpressionNode* m_expr;
Operator m_operator;
};
class
UnaryOpNode
:
public
ExpressionNode
{
public:
UnaryOpNode
(JSGlobalData*, ResultType, ExpressionNode*, OpcodeID);
protected:
ExpressionNode*
expr
() {
return
m_expr; }
const
ExpressionNode*
expr
()
const
{
return
m_expr; }
private:
virtual
RegisterID*
emitBytecode
(BytecodeGenerator&, RegisterID* =
0
);
OpcodeID
opcodeID
()
const
{
return
m_opcodeID; }
ExpressionNode* m_expr;
OpcodeID m_opcodeID;
};
class
UnaryPlusNode
:
public
UnaryOpNode
{
public:
UnaryPlusNode
(JSGlobalData*, ExpressionNode*);
private:
virtual
ExpressionNode*
stripUnaryPlus
() {
return
expr
(); }
};
class
NegateNode
:
public
UnaryOpNode
{
public:
NegateNode
(JSGlobalData*, ExpressionNode*);
};
class
BitwiseNotNode
:
public
UnaryOpNode
{
public:
BitwiseNotNode
(JSGlobalData*, ExpressionNode*);
};
class
LogicalNotNode
:
public
UnaryOpNode
{
public:
LogicalNotNode
(JSGlobalData*, ExpressionNode*);
private:
void
emitBytecodeInConditionContext
(BytecodeGenerator&, Label* trueTarget, Label* falseTarget,
bool
fallThroughMeansTrue);
virtual
bool
hasConditionContextCodegen
()
const
{
return
expr
()->
hasConditionContextCodegen
(); }
};
class
BinaryOpNode
:
public
ExpressionNode
{
public:
BinaryOpNode
(JSGlobalData*, ExpressionNode* expr1, ExpressionNode* expr2, OpcodeID,
bool
rightHasAssignments);
BinaryOpNode
(JSGlobalData*, ResultType, ExpressionNode* expr1, ExpressionNode* expr2, OpcodeID,
bool
rightHasAssignments);
RegisterID*
emitStrcat
(BytecodeGenerator& generator, RegisterID* destination, RegisterID* lhs =
0
, ReadModifyResolveNode* emitExpressionInfoForMe =
0
);
private:
virtual
RegisterID*
emitBytecode
(BytecodeGenerator&, RegisterID* =
0
);
protected:
OpcodeID
opcodeID
()
const
{
return
m_opcodeID; }
protected:
ExpressionNode* m_expr1;
ExpressionNode* m_expr2;
private:
OpcodeID m_opcodeID;
protected:
bool
m_rightHasAssignments;
};
class
ReverseBinaryOpNode
:
public
BinaryOpNode
{
public:
ReverseBinaryOpNode
(JSGlobalData*, ExpressionNode* expr1, ExpressionNode* expr2, OpcodeID,
bool
rightHasAssignments);
ReverseBinaryOpNode
(JSGlobalData*, ResultType, ExpressionNode* expr1, ExpressionNode* expr2, OpcodeID,
bool
rightHasAssignments);
virtual
RegisterID*
emitBytecode
(BytecodeGenerator&, RegisterID* =
0
);
};
class
MultNode
:
public
BinaryOpNode
{
public:
MultNode
(JSGlobalData*, ExpressionNode* expr1, ExpressionNode* expr2,
bool
rightHasAssignments);
};
class
DivNode
:
public
BinaryOpNode
{
public:
DivNode
(JSGlobalData*, ExpressionNode* expr1, ExpressionNode* expr2,
bool
rightHasAssignments);
};
class
ModNode
:
public
BinaryOpNode
{
public:
ModNode
(JSGlobalData*, ExpressionNode* expr1, ExpressionNode* expr2,
bool
rightHasAssignments);
};
class
AddNode
:
public
BinaryOpNode
{
public:
AddNode
(JSGlobalData*, ExpressionNode* expr1, ExpressionNode* expr2,
bool
rightHasAssignments);
virtual
bool
isAdd
()
const
{
return
true
; }
};
class
SubNode
:
public
BinaryOpNode
{
public:
SubNode
(JSGlobalData*, ExpressionNode* expr1, ExpressionNode* expr2,
bool
rightHasAssignments);
};
class
LeftShiftNode
:
public
BinaryOpNode
{
public:
LeftShiftNode
(JSGlobalData*, ExpressionNode* expr1, ExpressionNode* expr2,
bool
rightHasAssignments);
};
class
RightShiftNode
:
public
BinaryOpNode
{
public:
RightShiftNode
(JSGlobalData*, ExpressionNode* expr1, ExpressionNode* expr2,
bool
rightHasAssignments);
};
class
UnsignedRightShiftNode
:
public
BinaryOpNode
{
public:
UnsignedRightShiftNode
(JSGlobalData*, ExpressionNode* expr1, ExpressionNode* expr2,
bool
rightHasAssignments);
};
class
LessNode
:
public
BinaryOpNode
{
public:
LessNode
(JSGlobalData*, ExpressionNode* expr1, ExpressionNode* expr2,
bool
rightHasAssignments);
};
class
GreaterNode
:
public
ReverseBinaryOpNode
{
public:
GreaterNode
(JSGlobalData*, ExpressionNode* expr1, ExpressionNode* expr2,
bool
rightHasAssignments);
};
class
LessEqNode
:
public
BinaryOpNode
{
public:
LessEqNode
(JSGlobalData*, ExpressionNode* expr1, ExpressionNode* expr2,
bool
rightHasAssignments);
};
class
GreaterEqNode
:
public
ReverseBinaryOpNode
{
public:
GreaterEqNode
(JSGlobalData*, ExpressionNode* expr1, ExpressionNode* expr2,
bool
rightHasAssignments);
};
class
ThrowableBinaryOpNode
:
public
BinaryOpNode
,
public
ThrowableExpressionData
{
public:
ThrowableBinaryOpNode
(JSGlobalData*, ResultType, ExpressionNode* expr1, ExpressionNode* expr2, OpcodeID,
bool
rightHasAssignments);
ThrowableBinaryOpNode
(JSGlobalData*, ExpressionNode* expr1, ExpressionNode* expr2, OpcodeID,
bool
rightHasAssignments);
private:
virtual
RegisterID*
emitBytecode
(BytecodeGenerator&, RegisterID* =
0
);
};
class
InstanceOfNode
:
public
ThrowableBinaryOpNode
{
public:
InstanceOfNode
(JSGlobalData*, ExpressionNode* expr1, ExpressionNode* expr2,
bool
rightHasAssignments);
private:
virtual
RegisterID*
emitBytecode
(BytecodeGenerator&, RegisterID* =
0
);
};
class
InNode
:
public
ThrowableBinaryOpNode
{
public:
InNode
(JSGlobalData*, ExpressionNode* expr1, ExpressionNode* expr2,
bool
rightHasAssignments);
};
class
EqualNode
:
public
BinaryOpNode
{
public:
EqualNode
(JSGlobalData*, ExpressionNode* expr1, ExpressionNode* expr2,
bool
rightHasAssignments);
private:
virtual
RegisterID*
emitBytecode
(BytecodeGenerator&, RegisterID* =
0
);
};
class
NotEqualNode
:
public
BinaryOpNode
{
public:
NotEqualNode
(JSGlobalData*, ExpressionNode* expr1, ExpressionNode* expr2,
bool
rightHasAssignments);
};
class
StrictEqualNode
:
public
BinaryOpNode
{
public:
StrictEqualNode
(JSGlobalData*, ExpressionNode* expr1, ExpressionNode* expr2,
bool
rightHasAssignments);
private:
virtual
RegisterID*
emitBytecode
(BytecodeGenerator&, RegisterID* =
0
);
};
class
NotStrictEqualNode
:
public
BinaryOpNode
{
public:
NotStrictEqualNode
(JSGlobalData*, ExpressionNode* expr1, ExpressionNode* expr2,
bool
rightHasAssignments);
};
class
BitAndNode
:
public
BinaryOpNode
{
public:
BitAndNode
(JSGlobalData*, ExpressionNode* expr1, ExpressionNode* expr2,
bool
rightHasAssignments);
};
class
BitOrNode
:
public
BinaryOpNode
{
public:
BitOrNode
(JSGlobalData*, ExpressionNode* expr1, ExpressionNode* expr2,
bool
rightHasAssignments);
};
class
BitXOrNode
:
public
BinaryOpNode
{
public:
BitXOrNode
(JSGlobalData*, ExpressionNode* expr1, ExpressionNode* expr2,
bool
rightHasAssignments);
};
//
m_expr1 && m_expr2, m_expr1 || m_expr2
class
LogicalOpNode
:
public
ExpressionNode
{
public:
LogicalOpNode
(JSGlobalData*, ExpressionNode* expr1, ExpressionNode* expr2, LogicalOperator);
private:
virtual
RegisterID*
emitBytecode
(BytecodeGenerator&, RegisterID* =
0
);
void
emitBytecodeInConditionContext
(BytecodeGenerator&, Label* trueTarget, Label* falseTarget,
bool
fallThroughMeansTrue);
virtual
bool
hasConditionContextCodegen
()
const
{
return
true
; }
ExpressionNode* m_expr1;
ExpressionNode* m_expr2;
LogicalOperator m_operator;
};
//
The ternary operator, "m_logical ? m_expr1 : m_expr2"
class
ConditionalNode
:
public
ExpressionNode
{
public:
ConditionalNode
(JSGlobalData*, ExpressionNode* logical, ExpressionNode* expr1, ExpressionNode* expr2);
private:
virtual
RegisterID*
emitBytecode
(BytecodeGenerator&, RegisterID* =
0
);
ExpressionNode* m_logical;
ExpressionNode* m_expr1;
ExpressionNode* m_expr2;
};
class
ReadModifyResolveNode
:
public
ExpressionNode
,
public
ThrowableExpressionData
{
public:
ReadModifyResolveNode
(JSGlobalData*,
const
Identifier&, Operator, ExpressionNode* right,
bool
rightHasAssignments,
unsigned
divot,
unsigned
startOffset,
unsigned
endOffset);
private:
virtual
RegisterID*
emitBytecode
(BytecodeGenerator&, RegisterID* =
0
);
const
Identifier& m_ident;
ExpressionNode* m_right;
size_t
m_index;
//
Used by ReadModifyLocalVarNode.
Operator m_operator;
bool
m_rightHasAssignments;
};
class
AssignResolveNode
:
public
ExpressionNode
,
public
ThrowableExpressionData
{
public:
AssignResolveNode
(JSGlobalData*,
const
Identifier&, ExpressionNode* right,
bool
rightHasAssignments);
View remainder of file in raw view
Back
|
FazBrowse Home
|
New Git URL