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

Side by Side Diff: src/hydrogen.h

Issue 12385014: Hydrogen stubs for array constructors (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: More efficient code when number of arguments is known Created 7 years, 8 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
« no previous file with comments | « src/heap.h ('k') | src/hydrogen.cc » ('j') | src/hydrogen.cc » ('J')
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 18 matching lines...) Expand all
29 #define V8_HYDROGEN_H_ 29 #define V8_HYDROGEN_H_
30 30
31 #include "v8.h" 31 #include "v8.h"
32 32
33 #include "allocation.h" 33 #include "allocation.h"
34 #include "ast.h" 34 #include "ast.h"
35 #include "compiler.h" 35 #include "compiler.h"
36 #include "hydrogen-instructions.h" 36 #include "hydrogen-instructions.h"
37 #include "type-info.h" 37 #include "type-info.h"
38 #include "zone.h" 38 #include "zone.h"
39 #include "scopes.h"
39 40
40 namespace v8 { 41 namespace v8 {
41 namespace internal { 42 namespace internal {
42 43
43 // Forward declarations. 44 // Forward declarations.
44 class BitVector; 45 class BitVector;
45 class FunctionState; 46 class FunctionState;
46 class HEnvironment; 47 class HEnvironment;
47 class HGraph; 48 class HGraph;
48 class HLoopInformation; 49 class HLoopInformation;
(...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 void set_current_block(HBasicBlock* block) { current_block_ = block; } 876 void set_current_block(HBasicBlock* block) { current_block_ = block; }
876 HEnvironment* environment() const { 877 HEnvironment* environment() const {
877 return current_block()->last_environment(); 878 return current_block()->last_environment();
878 } 879 }
879 Zone* zone() const { return info_->zone(); } 880 Zone* zone() const { return info_->zone(); }
880 HGraph* graph() const { return graph_; } 881 HGraph* graph() const { return graph_; }
881 Isolate* isolate() const { return graph_->isolate(); } 882 Isolate* isolate() const { return graph_->isolate(); }
882 883
883 HGraph* CreateGraph(); 884 HGraph* CreateGraph();
884 885
886 // Bailout environment manipulation.
887 void Push(HValue* value) { environment()->Push(value); }
888 HValue* Pop() { return environment()->Pop(); }
889
885 // Adding instructions. 890 // Adding instructions.
886 HInstruction* AddInstruction(HInstruction* instr); 891 HInstruction* AddInstruction(HInstruction* instr);
887 void AddSimulate(BailoutId id, 892 void AddSimulate(BailoutId id,
888 RemovableSimulate removable = FIXED_SIMULATE); 893 RemovableSimulate removable = FIXED_SIMULATE);
889 HBoundsCheck* AddBoundsCheck( 894 HBoundsCheck* AddBoundsCheck(
890 HValue* index, 895 HValue* index,
891 HValue* length, 896 HValue* length,
892 BoundsCheckKeyMode key_mode = DONT_ALLOW_SMI_KEY, 897 BoundsCheckKeyMode key_mode = DONT_ALLOW_SMI_KEY,
893 Representation r = Representation::None()); 898 Representation r = Representation::None());
894 899
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
1056 private: 1061 private:
1057 HGraphBuilder* builder_; 1062 HGraphBuilder* builder_;
1058 }; 1063 };
1059 1064
1060 HValue* BuildNewElementsCapacity(HValue* context, 1065 HValue* BuildNewElementsCapacity(HValue* context,
1061 HValue* old_capacity); 1066 HValue* old_capacity);
1062 1067
1063 void BuildNewSpaceArrayCheck(HValue* length, 1068 void BuildNewSpaceArrayCheck(HValue* length,
1064 ElementsKind kind); 1069 ElementsKind kind);
1065 1070
1071 class JSArrayBuilder {
1072 public:
1073 JSArrayBuilder(HGraphBuilder* builder,
1074 ElementsKind kind,
1075 HValue* allocation_site_payload);
1076
1077 HValue* AllocateEmptyArray();
1078
1079 HValue* EstablishAllocationSize(HValue* length_node);
1080 HValue* AllocateArray(HValue* size_in_bytes, HValue* capacity,
1081 HValue* length_field, bool fill_with_hole);
1082 HValue* GetElementsLocation() { return elements_location_; }
1083
1084 private:
1085 Zone* zone() const { return builder_->zone(); }
1086 int elements_size() const {
1087 return IsFastDoubleElementsKind(kind_) ? kDoubleSize : kPointerSize;
1088 }
1089 HInstruction* AddInstruction(HInstruction* instr) {
1090 return builder_->AddInstruction(instr);
1091 }
1092 void AddSimulate(RemovableSimulate removable = FIXED_SIMULATE) {
1093 builder_->AddSimulate(BailoutId::StubEntry(), removable);
1094 }
1095 HGraphBuilder* builder() { return builder_; }
1096 HGraph* graph() { return builder_->graph(); }
1097 int initial_capacity() {
1098 STATIC_ASSERT(JSArray::kPreallocatedArrayElements > 0);
1099 return JSArray::kPreallocatedArrayElements;
1100 }
1101
1102 HValue* EmitMapCode(HValue* context);
1103 HValue* EstablishEmptyArrayAllocationSize();
1104 void FillWithHole(HValue* capacity, bool nominally_empty);
1105
1106 HGraphBuilder* builder_;
1107 ElementsKind kind_;
1108 AllocationSiteMode mode_;
1109 HValue* allocation_site_payload_;
1110 HInnerAllocatedObject* elements_location_;
1111 };
1112
1066 HValue* BuildAllocateElements(HValue* context, 1113 HValue* BuildAllocateElements(HValue* context,
1067 ElementsKind kind, 1114 ElementsKind kind,
1068 HValue* capacity); 1115 HValue* capacity);
1069 1116
1070 void BuildInitializeElements(HValue* elements, 1117 void BuildInitializeElements(HValue* elements,
1071 ElementsKind kind, 1118 ElementsKind kind,
1072 HValue* capacity); 1119 HValue* capacity);
1073 1120
1074 HValue* BuildAllocateAndInitializeElements(HValue* context, 1121 HValue* BuildAllocateAndInitializeElements(HValue* context,
1075 ElementsKind kind, 1122 ElementsKind kind,
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
1173 virtual bool BuildGraph(); 1220 virtual bool BuildGraph();
1174 1221
1175 // Simple accessors. 1222 // Simple accessors.
1176 BreakAndContinueScope* break_scope() const { return break_scope_; } 1223 BreakAndContinueScope* break_scope() const { return break_scope_; }
1177 void set_break_scope(BreakAndContinueScope* head) { break_scope_ = head; } 1224 void set_break_scope(BreakAndContinueScope* head) { break_scope_ = head; }
1178 1225
1179 bool inline_bailout() { return inline_bailout_; } 1226 bool inline_bailout() { return inline_bailout_; }
1180 1227
1181 void AddSoftDeoptimize(); 1228 void AddSoftDeoptimize();
1182 1229
1183 // Bailout environment manipulation.
1184 void Push(HValue* value) { environment()->Push(value); }
1185 HValue* Pop() { return environment()->Pop(); }
1186
1187 void Bailout(const char* reason); 1230 void Bailout(const char* reason);
1188 1231
1189 HBasicBlock* CreateJoin(HBasicBlock* first, 1232 HBasicBlock* CreateJoin(HBasicBlock* first,
1190 HBasicBlock* second, 1233 HBasicBlock* second,
1191 BailoutId join_id); 1234 BailoutId join_id);
1192 1235
1193 TypeFeedbackOracle* oracle() const { return function_state()->oracle(); } 1236 TypeFeedbackOracle* oracle() const { return function_state()->oracle(); }
1194 1237
1195 FunctionState* function_state() const { return function_state_; } 1238 FunctionState* function_state() const { return function_state_; }
1196 1239
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
1795 EmbeddedVector<char, 64> filename_; 1838 EmbeddedVector<char, 64> filename_;
1796 HeapStringAllocator string_allocator_; 1839 HeapStringAllocator string_allocator_;
1797 StringStream trace_; 1840 StringStream trace_;
1798 int indent_; 1841 int indent_;
1799 }; 1842 };
1800 1843
1801 1844
1802 } } // namespace v8::internal 1845 } } // namespace v8::internal
1803 1846
1804 #endif // V8_HYDROGEN_H_ 1847 #endif // V8_HYDROGEN_H_
OLDNEW
« no previous file with comments | « src/heap.h ('k') | src/hydrogen.cc » ('j') | src/hydrogen.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698