OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 struct Entry { | 49 struct Entry { |
50 String* key; | 50 String* key; |
51 Code* value; | 51 Code* value; |
52 }; | 52 }; |
53 | 53 |
54 | 54 |
55 static void Initialize(bool create_heap_objects); | 55 static void Initialize(bool create_heap_objects); |
56 | 56 |
57 // Computes the right stub matching. Inserts the result in the | 57 // Computes the right stub matching. Inserts the result in the |
58 // cache before returning. This might compile a stub if needed. | 58 // cache before returning. This might compile a stub if needed. |
59 MUST_USE_RESULT static Object* ComputeLoadNonexistent(String* name, | 59 MUST_USE_RESULT static MaybeObject* ComputeLoadNonexistent( |
60 JSObject* receiver); | 60 String* name, |
| 61 JSObject* receiver); |
61 | 62 |
62 MUST_USE_RESULT static Object* ComputeLoadField(String* name, | 63 MUST_USE_RESULT static MaybeObject* ComputeLoadField(String* name, |
63 JSObject* receiver, | |
64 JSObject* holder, | |
65 int field_index); | |
66 | |
67 MUST_USE_RESULT static Object* ComputeLoadCallback(String* name, | |
68 JSObject* receiver, | |
69 JSObject* holder, | |
70 AccessorInfo* callback); | |
71 | |
72 MUST_USE_RESULT static Object* ComputeLoadConstant(String* name, | |
73 JSObject* receiver, | |
74 JSObject* holder, | |
75 Object* value); | |
76 | |
77 MUST_USE_RESULT static Object* ComputeLoadInterceptor(String* name, | |
78 JSObject* receiver, | |
79 JSObject* holder); | |
80 | |
81 MUST_USE_RESULT static Object* ComputeLoadNormal(); | |
82 | |
83 | |
84 MUST_USE_RESULT static Object* ComputeLoadGlobal(String* name, | |
85 JSObject* receiver, | |
86 GlobalObject* holder, | |
87 JSGlobalPropertyCell* cell, | |
88 bool is_dont_delete); | |
89 | |
90 | |
91 // --- | |
92 | |
93 MUST_USE_RESULT static Object* ComputeKeyedLoadField(String* name, | |
94 JSObject* receiver, | 64 JSObject* receiver, |
95 JSObject* holder, | 65 JSObject* holder, |
96 int field_index); | 66 int field_index); |
97 | 67 |
98 MUST_USE_RESULT static Object* ComputeKeyedLoadCallback( | 68 MUST_USE_RESULT static MaybeObject* ComputeLoadCallback( |
99 String* name, | 69 String* name, |
100 JSObject* receiver, | 70 JSObject* receiver, |
101 JSObject* holder, | 71 JSObject* holder, |
102 AccessorInfo* callback); | 72 AccessorInfo* callback); |
103 | 73 |
104 MUST_USE_RESULT static Object* ComputeKeyedLoadConstant(String* name, | 74 MUST_USE_RESULT static MaybeObject* ComputeLoadConstant(String* name, |
105 JSObject* receiver, | 75 JSObject* receiver, |
106 JSObject* holder, | 76 JSObject* holder, |
107 Object* value); | 77 Object* value); |
108 | 78 |
109 MUST_USE_RESULT static Object* ComputeKeyedLoadInterceptor(String* name, | 79 MUST_USE_RESULT static MaybeObject* ComputeLoadInterceptor(String* name, |
110 JSObject* receiver, | 80 JSObject* receiver, |
111 JSObject* holder); | 81 JSObject* holder); |
112 | 82 |
113 MUST_USE_RESULT static Object* ComputeKeyedLoadArrayLength(String* name, | 83 MUST_USE_RESULT static MaybeObject* ComputeLoadNormal(); |
114 JSArray* receiver); | |
115 | 84 |
116 MUST_USE_RESULT static Object* ComputeKeyedLoadStringLength(String* name, | |
117 String* receiver); | |
118 | 85 |
119 MUST_USE_RESULT static Object* ComputeKeyedLoadFunctionPrototype( | 86 MUST_USE_RESULT static MaybeObject* ComputeLoadGlobal( |
| 87 String* name, |
| 88 JSObject* receiver, |
| 89 GlobalObject* holder, |
| 90 JSGlobalPropertyCell* cell, |
| 91 bool is_dont_delete); |
| 92 |
| 93 |
| 94 // --- |
| 95 |
| 96 MUST_USE_RESULT static MaybeObject* ComputeKeyedLoadField(String* name, |
| 97 JSObject* receiver, |
| 98 JSObject* holder, |
| 99 int field_index); |
| 100 |
| 101 MUST_USE_RESULT static MaybeObject* ComputeKeyedLoadCallback( |
| 102 String* name, |
| 103 JSObject* receiver, |
| 104 JSObject* holder, |
| 105 AccessorInfo* callback); |
| 106 |
| 107 MUST_USE_RESULT static MaybeObject* ComputeKeyedLoadConstant( |
| 108 String* name, |
| 109 JSObject* receiver, |
| 110 JSObject* holder, |
| 111 Object* value); |
| 112 |
| 113 MUST_USE_RESULT static MaybeObject* ComputeKeyedLoadInterceptor( |
| 114 String* name, |
| 115 JSObject* receiver, |
| 116 JSObject* holder); |
| 117 |
| 118 MUST_USE_RESULT static MaybeObject* ComputeKeyedLoadArrayLength( |
| 119 String* name, |
| 120 JSArray* receiver); |
| 121 |
| 122 MUST_USE_RESULT static MaybeObject* ComputeKeyedLoadStringLength( |
| 123 String* name, |
| 124 String* receiver); |
| 125 |
| 126 MUST_USE_RESULT static MaybeObject* ComputeKeyedLoadFunctionPrototype( |
120 String* name, | 127 String* name, |
121 JSFunction* receiver); | 128 JSFunction* receiver); |
122 | 129 |
123 // --- | 130 // --- |
124 | 131 |
125 MUST_USE_RESULT static Object* ComputeStoreField(String* name, | 132 MUST_USE_RESULT static MaybeObject* ComputeStoreField(String* name, |
126 JSObject* receiver, | |
127 int field_index, | |
128 Map* transition = NULL); | |
129 | |
130 MUST_USE_RESULT static Object* ComputeStoreNormal(); | |
131 | |
132 MUST_USE_RESULT static Object* ComputeStoreGlobal(String* name, | |
133 GlobalObject* receiver, | |
134 JSGlobalPropertyCell* cell); | |
135 | |
136 MUST_USE_RESULT static Object* ComputeStoreCallback(String* name, | |
137 JSObject* receiver, | |
138 AccessorInfo* callback); | |
139 | |
140 MUST_USE_RESULT static Object* ComputeStoreInterceptor(String* name, | |
141 JSObject* receiver); | |
142 | |
143 // --- | |
144 | |
145 MUST_USE_RESULT static Object* ComputeKeyedStoreField(String* name, | |
146 JSObject* receiver, | 133 JSObject* receiver, |
147 int field_index, | 134 int field_index, |
148 Map* transition = NULL); | 135 Map* transition = NULL); |
149 | 136 |
150 // --- | 137 MUST_USE_RESULT static MaybeObject* ComputeStoreNormal(); |
151 | 138 |
152 MUST_USE_RESULT static Object* ComputeCallField(int argc, | 139 MUST_USE_RESULT static MaybeObject* ComputeStoreGlobal( |
153 InLoopFlag in_loop, | 140 String* name, |
154 Code::Kind, | 141 GlobalObject* receiver, |
155 String* name, | 142 JSGlobalPropertyCell* cell); |
156 Object* object, | |
157 JSObject* holder, | |
158 int index); | |
159 | 143 |
160 MUST_USE_RESULT static Object* ComputeCallConstant(int argc, | 144 MUST_USE_RESULT static MaybeObject* ComputeStoreCallback( |
161 InLoopFlag in_loop, | 145 String* name, |
162 Code::Kind, | 146 JSObject* receiver, |
163 String* name, | 147 AccessorInfo* callback); |
164 Object* object, | |
165 JSObject* holder, | |
166 JSFunction* function); | |
167 | 148 |
168 MUST_USE_RESULT static Object* ComputeCallNormal(int argc, | 149 MUST_USE_RESULT static MaybeObject* ComputeStoreInterceptor( |
169 InLoopFlag in_loop, | 150 String* name, |
170 Code::Kind, | 151 JSObject* receiver); |
171 String* name, | |
172 JSObject* receiver); | |
173 | |
174 MUST_USE_RESULT static Object* ComputeCallInterceptor(int argc, | |
175 Code::Kind, | |
176 String* name, | |
177 Object* object, | |
178 JSObject* holder); | |
179 | |
180 MUST_USE_RESULT static Object* ComputeCallGlobal(int argc, | |
181 InLoopFlag in_loop, | |
182 Code::Kind, | |
183 String* name, | |
184 JSObject* receiver, | |
185 GlobalObject* holder, | |
186 JSGlobalPropertyCell* cell, | |
187 JSFunction* function); | |
188 | 152 |
189 // --- | 153 // --- |
190 | 154 |
191 MUST_USE_RESULT static Object* ComputeCallInitialize(int argc, | 155 MUST_USE_RESULT static MaybeObject* ComputeKeyedStoreField( |
| 156 String* name, |
| 157 JSObject* receiver, |
| 158 int field_index, |
| 159 Map* transition = NULL); |
| 160 |
| 161 // --- |
| 162 |
| 163 MUST_USE_RESULT static MaybeObject* ComputeCallField(int argc, |
192 InLoopFlag in_loop, | 164 InLoopFlag in_loop, |
193 Code::Kind kind); | 165 Code::Kind, |
| 166 String* name, |
| 167 Object* object, |
| 168 JSObject* holder, |
| 169 int index); |
194 | 170 |
195 MUST_USE_RESULT static Object* ComputeCallPreMonomorphic(int argc, | 171 MUST_USE_RESULT static MaybeObject* ComputeCallConstant(int argc, |
196 InLoopFlag in_loop, | 172 InLoopFlag in_loop, |
197 Code::Kind kind); | 173 Code::Kind, |
| 174 String* name, |
| 175 Object* object, |
| 176 JSObject* holder, |
| 177 JSFunction* function); |
198 | 178 |
199 MUST_USE_RESULT static Object* ComputeCallNormal(int argc, | 179 MUST_USE_RESULT static MaybeObject* ComputeCallNormal(int argc, |
200 InLoopFlag in_loop, | 180 InLoopFlag in_loop, |
201 Code::Kind kind); | 181 Code::Kind, |
| 182 String* name, |
| 183 JSObject* receiver); |
202 | 184 |
203 MUST_USE_RESULT static Object* ComputeCallMegamorphic(int argc, | 185 MUST_USE_RESULT static MaybeObject* ComputeCallInterceptor(int argc, |
| 186 Code::Kind, |
| 187 String* name, |
| 188 Object* object, |
| 189 JSObject* holder); |
| 190 |
| 191 MUST_USE_RESULT static MaybeObject* ComputeCallGlobal( |
| 192 int argc, |
| 193 InLoopFlag in_loop, |
| 194 Code::Kind, |
| 195 String* name, |
| 196 JSObject* receiver, |
| 197 GlobalObject* holder, |
| 198 JSGlobalPropertyCell* cell, |
| 199 JSFunction* function); |
| 200 |
| 201 // --- |
| 202 |
| 203 MUST_USE_RESULT static MaybeObject* ComputeCallInitialize(int argc, |
| 204 InLoopFlag in_loop, |
| 205 Code::Kind kind); |
| 206 |
| 207 MUST_USE_RESULT static MaybeObject* ComputeCallPreMonomorphic( |
| 208 int argc, |
| 209 InLoopFlag in_loop, |
| 210 Code::Kind kind); |
| 211 |
| 212 MUST_USE_RESULT static MaybeObject* ComputeCallNormal(int argc, |
204 InLoopFlag in_loop, | 213 InLoopFlag in_loop, |
205 Code::Kind kind); | 214 Code::Kind kind); |
206 | 215 |
207 MUST_USE_RESULT static Object* ComputeCallMiss(int argc, Code::Kind kind); | 216 MUST_USE_RESULT static MaybeObject* ComputeCallMegamorphic(int argc, |
| 217 InLoopFlag in_loop, |
| 218 Code::Kind kind); |
| 219 |
| 220 MUST_USE_RESULT static MaybeObject* ComputeCallMiss(int argc, |
| 221 Code::Kind kind); |
208 | 222 |
209 // Finds the Code object stored in the Heap::non_monomorphic_cache(). | 223 // Finds the Code object stored in the Heap::non_monomorphic_cache(). |
210 MUST_USE_RESULT static Code* FindCallInitialize(int argc, | 224 MUST_USE_RESULT static Code* FindCallInitialize(int argc, |
211 InLoopFlag in_loop, | 225 InLoopFlag in_loop, |
212 Code::Kind kind); | 226 Code::Kind kind); |
213 | 227 |
214 #ifdef ENABLE_DEBUGGER_SUPPORT | 228 #ifdef ENABLE_DEBUGGER_SUPPORT |
215 MUST_USE_RESULT static Object* ComputeCallDebugBreak(int argc, | 229 MUST_USE_RESULT static MaybeObject* ComputeCallDebugBreak(int argc, |
216 Code::Kind kind); | 230 Code::Kind kind); |
217 | 231 |
218 MUST_USE_RESULT static Object* ComputeCallDebugPrepareStepIn(int argc, | 232 MUST_USE_RESULT static MaybeObject* ComputeCallDebugPrepareStepIn( |
219 Code::Kind kind); | 233 int argc, |
| 234 Code::Kind kind); |
220 #endif | 235 #endif |
221 | 236 |
222 // Update cache for entry hash(name, map). | 237 // Update cache for entry hash(name, map). |
223 static Code* Set(String* name, Map* map, Code* code); | 238 static Code* Set(String* name, Map* map, Code* code); |
224 | 239 |
225 // Clear the lookup table (@ mark compact collection). | 240 // Clear the lookup table (@ mark compact collection). |
226 static void Clear(); | 241 static void Clear(); |
227 | 242 |
228 // Generate code for probing the stub cache table. | 243 // Generate code for probing the stub cache table. |
229 // If extra != no_reg it might be used as am extra scratch register. | 244 // If extra != no_reg it might be used as am extra scratch register. |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 return NULL; | 337 return NULL; |
323 } | 338 } |
324 | 339 |
325 Address address_; | 340 Address address_; |
326 }; | 341 }; |
327 | 342 |
328 // ------------------------------------------------------------------------ | 343 // ------------------------------------------------------------------------ |
329 | 344 |
330 | 345 |
331 // Support functions for IC stubs for callbacks. | 346 // Support functions for IC stubs for callbacks. |
332 Object* LoadCallbackProperty(Arguments args); | 347 MaybeObject* LoadCallbackProperty(Arguments args); |
333 Object* StoreCallbackProperty(Arguments args); | 348 MaybeObject* StoreCallbackProperty(Arguments args); |
334 | 349 |
335 | 350 |
336 // Support functions for IC stubs for interceptors. | 351 // Support functions for IC stubs for interceptors. |
337 Object* LoadPropertyWithInterceptorOnly(Arguments args); | 352 MaybeObject* LoadPropertyWithInterceptorOnly(Arguments args); |
338 Object* LoadPropertyWithInterceptorForLoad(Arguments args); | 353 MaybeObject* LoadPropertyWithInterceptorForLoad(Arguments args); |
339 Object* LoadPropertyWithInterceptorForCall(Arguments args); | 354 MaybeObject* LoadPropertyWithInterceptorForCall(Arguments args); |
340 Object* StoreInterceptorProperty(Arguments args); | 355 MaybeObject* StoreInterceptorProperty(Arguments args); |
341 Object* CallInterceptorProperty(Arguments args); | 356 MaybeObject* CallInterceptorProperty(Arguments args); |
342 Object* KeyedLoadPropertyWithInterceptor(Arguments args); | 357 MaybeObject* KeyedLoadPropertyWithInterceptor(Arguments args); |
343 | 358 |
344 | 359 |
345 // The stub compiler compiles stubs for the stub cache. | 360 // The stub compiler compiles stubs for the stub cache. |
346 class StubCompiler BASE_EMBEDDED { | 361 class StubCompiler BASE_EMBEDDED { |
347 public: | 362 public: |
348 enum CheckType { | 363 enum CheckType { |
349 RECEIVER_MAP_CHECK, | 364 RECEIVER_MAP_CHECK, |
350 STRING_CHECK, | 365 STRING_CHECK, |
351 NUMBER_CHECK, | 366 NUMBER_CHECK, |
352 BOOLEAN_CHECK | 367 BOOLEAN_CHECK |
353 }; | 368 }; |
354 | 369 |
355 StubCompiler() : scope_(), masm_(NULL, 256), failure_(NULL) { } | 370 StubCompiler() : scope_(), masm_(NULL, 256), failure_(NULL) { } |
356 | 371 |
357 Object* CompileCallInitialize(Code::Flags flags); | 372 MUST_USE_RESULT MaybeObject* CompileCallInitialize(Code::Flags flags); |
358 Object* CompileCallPreMonomorphic(Code::Flags flags); | 373 MUST_USE_RESULT MaybeObject* CompileCallPreMonomorphic(Code::Flags flags); |
359 Object* CompileCallNormal(Code::Flags flags); | 374 MUST_USE_RESULT MaybeObject* CompileCallNormal(Code::Flags flags); |
360 Object* CompileCallMegamorphic(Code::Flags flags); | 375 MUST_USE_RESULT MaybeObject* CompileCallMegamorphic(Code::Flags flags); |
361 Object* CompileCallMiss(Code::Flags flags); | 376 MUST_USE_RESULT MaybeObject* CompileCallMiss(Code::Flags flags); |
362 #ifdef ENABLE_DEBUGGER_SUPPORT | 377 #ifdef ENABLE_DEBUGGER_SUPPORT |
363 Object* CompileCallDebugBreak(Code::Flags flags); | 378 MUST_USE_RESULT MaybeObject* CompileCallDebugBreak(Code::Flags flags); |
364 Object* CompileCallDebugPrepareStepIn(Code::Flags flags); | 379 MUST_USE_RESULT MaybeObject* CompileCallDebugPrepareStepIn(Code::Flags flags); |
365 #endif | 380 #endif |
366 | 381 |
367 // Static functions for generating parts of stubs. | 382 // Static functions for generating parts of stubs. |
368 static void GenerateLoadGlobalFunctionPrototype(MacroAssembler* masm, | 383 static void GenerateLoadGlobalFunctionPrototype(MacroAssembler* masm, |
369 int index, | 384 int index, |
370 Register prototype); | 385 Register prototype); |
371 | 386 |
372 // Generates prototype loading code that uses the objects from the | 387 // Generates prototype loading code that uses the objects from the |
373 // context we were in when this function was called. If the context | 388 // context we were in when this function was called. If the context |
374 // has changed, a jump to miss is performed. This ties the generated | 389 // has changed, a jump to miss is performed. This ties the generated |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 Register object_reg, | 459 Register object_reg, |
445 JSObject* holder, | 460 JSObject* holder, |
446 Register holder_reg, | 461 Register holder_reg, |
447 Register scratch1, | 462 Register scratch1, |
448 Register scratch2, | 463 Register scratch2, |
449 String* name, | 464 String* name, |
450 int save_at_depth, | 465 int save_at_depth, |
451 Label* miss); | 466 Label* miss); |
452 | 467 |
453 protected: | 468 protected: |
454 Object* GetCodeWithFlags(Code::Flags flags, const char* name); | 469 MaybeObject* GetCodeWithFlags(Code::Flags flags, const char* name); |
455 Object* GetCodeWithFlags(Code::Flags flags, String* name); | 470 MaybeObject* GetCodeWithFlags(Code::Flags flags, String* name); |
456 | 471 |
457 MacroAssembler* masm() { return &masm_; } | 472 MacroAssembler* masm() { return &masm_; } |
458 void set_failure(Failure* failure) { failure_ = failure; } | 473 void set_failure(Failure* failure) { failure_ = failure; } |
459 | 474 |
460 void GenerateLoadField(JSObject* object, | 475 void GenerateLoadField(JSObject* object, |
461 JSObject* holder, | 476 JSObject* holder, |
462 Register receiver, | 477 Register receiver, |
463 Register scratch1, | 478 Register scratch1, |
464 Register scratch2, | 479 Register scratch2, |
465 Register scratch3, | 480 Register scratch3, |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 | 521 |
507 private: | 522 private: |
508 HandleScope scope_; | 523 HandleScope scope_; |
509 MacroAssembler masm_; | 524 MacroAssembler masm_; |
510 Failure* failure_; | 525 Failure* failure_; |
511 }; | 526 }; |
512 | 527 |
513 | 528 |
514 class LoadStubCompiler: public StubCompiler { | 529 class LoadStubCompiler: public StubCompiler { |
515 public: | 530 public: |
516 Object* CompileLoadNonexistent(String* name, | 531 MUST_USE_RESULT MaybeObject* CompileLoadNonexistent(String* name, |
517 JSObject* object, | 532 JSObject* object, |
518 JSObject* last); | 533 JSObject* last); |
519 | 534 |
520 Object* CompileLoadField(JSObject* object, | 535 MUST_USE_RESULT MaybeObject* CompileLoadField(JSObject* object, |
521 JSObject* holder, | 536 JSObject* holder, |
522 int index, | 537 int index, |
523 String* name); | 538 String* name); |
524 | 539 |
525 Object* CompileLoadCallback(String* name, | 540 MUST_USE_RESULT MaybeObject* CompileLoadCallback(String* name, |
526 JSObject* object, | 541 JSObject* object, |
527 JSObject* holder, | 542 JSObject* holder, |
528 AccessorInfo* callback); | 543 AccessorInfo* callback); |
529 | 544 |
530 Object* CompileLoadConstant(JSObject* object, | 545 MUST_USE_RESULT MaybeObject* CompileLoadConstant(JSObject* object, |
531 JSObject* holder, | 546 JSObject* holder, |
532 Object* value, | 547 Object* value, |
533 String* name); | 548 String* name); |
534 | 549 |
535 Object* CompileLoadInterceptor(JSObject* object, | 550 MUST_USE_RESULT MaybeObject* CompileLoadInterceptor(JSObject* object, |
536 JSObject* holder, | 551 JSObject* holder, |
537 String* name); | 552 String* name); |
538 | 553 |
539 Object* CompileLoadGlobal(JSObject* object, | 554 MUST_USE_RESULT MaybeObject* CompileLoadGlobal(JSObject* object, |
540 GlobalObject* holder, | 555 GlobalObject* holder, |
541 JSGlobalPropertyCell* cell, | 556 JSGlobalPropertyCell* cell, |
542 String* name, | 557 String* name, |
543 bool is_dont_delete); | 558 bool is_dont_delete); |
544 | 559 |
545 private: | 560 private: |
546 Object* GetCode(PropertyType type, String* name); | 561 MaybeObject* GetCode(PropertyType type, String* name); |
547 }; | 562 }; |
548 | 563 |
549 | 564 |
550 class KeyedLoadStubCompiler: public StubCompiler { | 565 class KeyedLoadStubCompiler: public StubCompiler { |
551 public: | 566 public: |
552 Object* CompileLoadField(String* name, | 567 MUST_USE_RESULT MaybeObject* CompileLoadField(String* name, |
553 JSObject* object, | 568 JSObject* object, |
554 JSObject* holder, | 569 JSObject* holder, |
555 int index); | 570 int index); |
556 | 571 |
557 Object* CompileLoadCallback(String* name, | 572 MUST_USE_RESULT MaybeObject* CompileLoadCallback(String* name, |
558 JSObject* object, | 573 JSObject* object, |
559 JSObject* holder, | 574 JSObject* holder, |
560 AccessorInfo* callback); | 575 AccessorInfo* callback); |
561 | 576 |
562 Object* CompileLoadConstant(String* name, | 577 MUST_USE_RESULT MaybeObject* CompileLoadConstant(String* name, |
563 JSObject* object, | 578 JSObject* object, |
564 JSObject* holder, | 579 JSObject* holder, |
565 Object* value); | 580 Object* value); |
566 | 581 |
567 Object* CompileLoadInterceptor(JSObject* object, | 582 MUST_USE_RESULT MaybeObject* CompileLoadInterceptor(JSObject* object, |
568 JSObject* holder, | 583 JSObject* holder, |
569 String* name); | 584 String* name); |
570 | 585 |
571 Object* CompileLoadArrayLength(String* name); | 586 MUST_USE_RESULT MaybeObject* CompileLoadArrayLength(String* name); |
572 Object* CompileLoadStringLength(String* name); | 587 MUST_USE_RESULT MaybeObject* CompileLoadStringLength(String* name); |
573 Object* CompileLoadFunctionPrototype(String* name); | 588 MUST_USE_RESULT MaybeObject* CompileLoadFunctionPrototype(String* name); |
574 | 589 |
575 private: | 590 private: |
576 Object* GetCode(PropertyType type, String* name); | 591 MaybeObject* GetCode(PropertyType type, String* name); |
577 }; | 592 }; |
578 | 593 |
579 | 594 |
580 class StoreStubCompiler: public StubCompiler { | 595 class StoreStubCompiler: public StubCompiler { |
581 public: | 596 public: |
582 Object* CompileStoreField(JSObject* object, | 597 MUST_USE_RESULT MaybeObject* CompileStoreField(JSObject* object, |
583 int index, | 598 int index, |
584 Map* transition, | 599 Map* transition, |
585 String* name); | 600 String* name); |
586 Object* CompileStoreCallback(JSObject* object, | 601 MUST_USE_RESULT MaybeObject* CompileStoreCallback(JSObject* object, |
587 AccessorInfo* callbacks, | 602 AccessorInfo* callbacks, |
588 String* name); | 603 String* name); |
589 Object* CompileStoreInterceptor(JSObject* object, String* name); | 604 MUST_USE_RESULT MaybeObject* CompileStoreInterceptor(JSObject* object, |
590 Object* CompileStoreGlobal(GlobalObject* object, | 605 String* name); |
591 JSGlobalPropertyCell* holder, | 606 MUST_USE_RESULT MaybeObject* CompileStoreGlobal(GlobalObject* object, |
592 String* name); | 607 JSGlobalPropertyCell* holder, |
| 608 String* name); |
593 | 609 |
594 | 610 |
595 private: | 611 private: |
596 Object* GetCode(PropertyType type, String* name); | 612 MUST_USE_RESULT MaybeObject* GetCode(PropertyType type, String* name); |
597 }; | 613 }; |
598 | 614 |
599 | 615 |
600 class KeyedStoreStubCompiler: public StubCompiler { | 616 class KeyedStoreStubCompiler: public StubCompiler { |
601 public: | 617 public: |
602 Object* CompileStoreField(JSObject* object, | 618 MaybeObject* CompileStoreField(JSObject* object, |
603 int index, | 619 int index, |
604 Map* transition, | 620 Map* transition, |
605 String* name); | 621 String* name); |
606 | 622 |
607 private: | 623 private: |
608 Object* GetCode(PropertyType type, String* name); | 624 MaybeObject* GetCode(PropertyType type, String* name); |
609 }; | 625 }; |
610 | 626 |
611 | 627 |
612 // List of functions with custom constant call IC stubs. | 628 // List of functions with custom constant call IC stubs. |
613 // | 629 // |
614 // Installation of custom call generators for the selected builtins is | 630 // Installation of custom call generators for the selected builtins is |
615 // handled by the bootstrapper. | 631 // handled by the bootstrapper. |
616 // | 632 // |
617 // Each entry has a name of a global object property holding an object | 633 // Each entry has a name of a global object property holding an object |
618 // optionally followed by ".prototype" (this controls whether the | 634 // optionally followed by ".prototype" (this controls whether the |
(...skipping 19 matching lines...) Expand all Loading... |
638 CUSTOM_CALL_IC_GENERATORS(DECLARE_CALL_GENERATOR_ID) | 654 CUSTOM_CALL_IC_GENERATORS(DECLARE_CALL_GENERATOR_ID) |
639 #undef DECLARE_CALL_GENERATOR_ID | 655 #undef DECLARE_CALL_GENERATOR_ID |
640 kNumCallGenerators | 656 kNumCallGenerators |
641 }; | 657 }; |
642 | 658 |
643 CallStubCompiler(int argc, | 659 CallStubCompiler(int argc, |
644 InLoopFlag in_loop, | 660 InLoopFlag in_loop, |
645 Code::Kind kind, | 661 Code::Kind kind, |
646 InlineCacheHolderFlag cache_holder); | 662 InlineCacheHolderFlag cache_holder); |
647 | 663 |
648 Object* CompileCallField(JSObject* object, | 664 MUST_USE_RESULT MaybeObject* CompileCallField(JSObject* object, |
649 JSObject* holder, | 665 JSObject* holder, |
650 int index, | 666 int index, |
651 String* name); | 667 String* name); |
652 Object* CompileCallConstant(Object* object, | 668 MUST_USE_RESULT MaybeObject* CompileCallConstant(Object* object, |
653 JSObject* holder, | 669 JSObject* holder, |
654 JSFunction* function, | 670 JSFunction* function, |
655 String* name, | 671 String* name, |
656 CheckType check); | 672 CheckType check); |
657 Object* CompileCallInterceptor(JSObject* object, | 673 MUST_USE_RESULT MaybeObject* CompileCallInterceptor(JSObject* object, |
658 JSObject* holder, | 674 JSObject* holder, |
659 String* name); | 675 String* name); |
660 Object* CompileCallGlobal(JSObject* object, | 676 MUST_USE_RESULT MaybeObject* CompileCallGlobal(JSObject* object, |
661 GlobalObject* holder, | 677 GlobalObject* holder, |
662 JSGlobalPropertyCell* cell, | 678 JSGlobalPropertyCell* cell, |
663 JSFunction* function, | 679 JSFunction* function, |
664 String* name); | 680 String* name); |
665 | 681 |
666 // Compiles a custom call constant/global IC using the generator | 682 // Compiles a custom call constant/global IC using the generator |
667 // with given id. For constant calls cell is NULL. | 683 // with given id. For constant calls cell is NULL. |
668 Object* CompileCustomCall(int generator_id, | 684 MUST_USE_RESULT MaybeObject* CompileCustomCall(int generator_id, |
669 Object* object, | 685 Object* object, |
670 JSObject* holder, | 686 JSObject* holder, |
671 JSGlobalPropertyCell* cell, | 687 JSGlobalPropertyCell* cell, |
672 JSFunction* function, | 688 JSFunction* function, |
673 String* name); | 689 String* name); |
674 | 690 |
675 #define DECLARE_CALL_GENERATOR(ignored1, ignored2, name) \ | 691 #define DECLARE_CALL_GENERATOR(ignored1, ignored2, name) \ |
676 Object* Compile##name##Call(Object* object, \ | 692 MUST_USE_RESULT MaybeObject* Compile##name##Call(Object* object, \ |
677 JSObject* holder, \ | 693 JSObject* holder, \ |
678 JSGlobalPropertyCell* cell, \ | 694 JSGlobalPropertyCell* cell, \ |
679 JSFunction* function, \ | 695 JSFunction* function, \ |
680 String* fname); | 696 String* fname); |
681 CUSTOM_CALL_IC_GENERATORS(DECLARE_CALL_GENERATOR) | 697 CUSTOM_CALL_IC_GENERATORS(DECLARE_CALL_GENERATOR) |
682 #undef DECLARE_CALL_GENERATOR | 698 #undef DECLARE_CALL_GENERATOR |
683 | 699 |
684 private: | 700 private: |
685 const ParameterCount arguments_; | 701 const ParameterCount arguments_; |
686 const InLoopFlag in_loop_; | 702 const InLoopFlag in_loop_; |
687 const Code::Kind kind_; | 703 const Code::Kind kind_; |
688 const InlineCacheHolderFlag cache_holder_; | 704 const InlineCacheHolderFlag cache_holder_; |
689 | 705 |
690 const ParameterCount& arguments() { return arguments_; } | 706 const ParameterCount& arguments() { return arguments_; } |
691 | 707 |
692 Object* GetCode(PropertyType type, String* name); | 708 MUST_USE_RESULT MaybeObject* GetCode(PropertyType type, String* name); |
693 | 709 |
694 // Convenience function. Calls GetCode above passing | 710 // Convenience function. Calls GetCode above passing |
695 // CONSTANT_FUNCTION type and the name of the given function. | 711 // CONSTANT_FUNCTION type and the name of the given function. |
696 Object* GetCode(JSFunction* function); | 712 MUST_USE_RESULT MaybeObject* GetCode(JSFunction* function); |
697 | 713 |
698 void GenerateNameCheck(String* name, Label* miss); | 714 void GenerateNameCheck(String* name, Label* miss); |
699 | 715 |
700 void GenerateGlobalReceiverCheck(JSObject* object, | 716 void GenerateGlobalReceiverCheck(JSObject* object, |
701 JSObject* holder, | 717 JSObject* holder, |
702 String* name, | 718 String* name, |
703 Label* miss); | 719 Label* miss); |
704 | 720 |
705 // Generates code to load the function from the cell checking that | 721 // Generates code to load the function from the cell checking that |
706 // it still contains the same function. | 722 // it still contains the same function. |
707 void GenerateLoadFunctionFromCell(JSGlobalPropertyCell* cell, | 723 void GenerateLoadFunctionFromCell(JSGlobalPropertyCell* cell, |
708 JSFunction* function, | 724 JSFunction* function, |
709 Label* miss); | 725 Label* miss); |
710 | 726 |
711 // Generates a jump to CallIC miss stub. Returns Failure if the jump cannot | 727 // Generates a jump to CallIC miss stub. Returns Failure if the jump cannot |
712 // be generated. | 728 // be generated. |
713 Object* GenerateMissBranch(); | 729 MUST_USE_RESULT MaybeObject* GenerateMissBranch(); |
714 }; | 730 }; |
715 | 731 |
716 | 732 |
717 class ConstructStubCompiler: public StubCompiler { | 733 class ConstructStubCompiler: public StubCompiler { |
718 public: | 734 public: |
719 explicit ConstructStubCompiler() {} | 735 explicit ConstructStubCompiler() {} |
720 | 736 |
721 Object* CompileConstructStub(SharedFunctionInfo* shared); | 737 MUST_USE_RESULT MaybeObject* CompileConstructStub(SharedFunctionInfo* shared); |
722 | 738 |
723 private: | 739 private: |
724 Object* GetCode(); | 740 MaybeObject* GetCode(); |
725 }; | 741 }; |
726 | 742 |
727 | 743 |
728 // Holds information about possible function call optimizations. | 744 // Holds information about possible function call optimizations. |
729 class CallOptimization BASE_EMBEDDED { | 745 class CallOptimization BASE_EMBEDDED { |
730 public: | 746 public: |
731 explicit CallOptimization(LookupResult* lookup); | 747 explicit CallOptimization(LookupResult* lookup); |
732 | 748 |
733 explicit CallOptimization(JSFunction* function); | 749 explicit CallOptimization(JSFunction* function); |
734 | 750 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
769 | 785 |
770 JSFunction* constant_function_; | 786 JSFunction* constant_function_; |
771 bool is_simple_api_call_; | 787 bool is_simple_api_call_; |
772 FunctionTemplateInfo* expected_receiver_type_; | 788 FunctionTemplateInfo* expected_receiver_type_; |
773 CallHandlerInfo* api_call_info_; | 789 CallHandlerInfo* api_call_info_; |
774 }; | 790 }; |
775 | 791 |
776 } } // namespace v8::internal | 792 } } // namespace v8::internal |
777 | 793 |
778 #endif // V8_STUB_CACHE_H_ | 794 #endif // V8_STUB_CACHE_H_ |
OLD | NEW |