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

Side by Side Diff: src/builtins.h

Issue 1609893003: [es6] Tail calls support. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebasing Created 4 years, 11 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/bootstrapper.cc ('k') | src/builtins.cc » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 #ifndef V8_BUILTINS_H_ 5 #ifndef V8_BUILTINS_H_
6 #define V8_BUILTINS_H_ 6 #define V8_BUILTINS_H_
7 7
8 #include "src/base/flags.h" 8 #include "src/base/flags.h"
9 #include "src/handles.h" 9 #include "src/handles.h"
10 10
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 #define BUILTIN_LIST_A(V) \ 152 #define BUILTIN_LIST_A(V) \
153 V(ArgumentsAdaptorTrampoline, BUILTIN, UNINITIALIZED, kNoExtraICState) \ 153 V(ArgumentsAdaptorTrampoline, BUILTIN, UNINITIALIZED, kNoExtraICState) \
154 \ 154 \
155 V(ConstructedNonConstructable, BUILTIN, UNINITIALIZED, kNoExtraICState) \ 155 V(ConstructedNonConstructable, BUILTIN, UNINITIALIZED, kNoExtraICState) \
156 \ 156 \
157 V(CallFunction_ReceiverIsNullOrUndefined, BUILTIN, UNINITIALIZED, \ 157 V(CallFunction_ReceiverIsNullOrUndefined, BUILTIN, UNINITIALIZED, \
158 kNoExtraICState) \ 158 kNoExtraICState) \
159 V(CallFunction_ReceiverIsNotNullOrUndefined, BUILTIN, UNINITIALIZED, \ 159 V(CallFunction_ReceiverIsNotNullOrUndefined, BUILTIN, UNINITIALIZED, \
160 kNoExtraICState) \ 160 kNoExtraICState) \
161 V(CallFunction_ReceiverIsAny, BUILTIN, UNINITIALIZED, kNoExtraICState) \ 161 V(CallFunction_ReceiverIsAny, BUILTIN, UNINITIALIZED, kNoExtraICState) \
162 V(TailCallFunction_ReceiverIsNullOrUndefined, BUILTIN, UNINITIALIZED, \
163 kNoExtraICState) \
164 V(TailCallFunction_ReceiverIsNotNullOrUndefined, BUILTIN, UNINITIALIZED, \
165 kNoExtraICState) \
166 V(TailCallFunction_ReceiverIsAny, BUILTIN, UNINITIALIZED, kNoExtraICState) \
162 V(CallBoundFunction, BUILTIN, UNINITIALIZED, kNoExtraICState) \ 167 V(CallBoundFunction, BUILTIN, UNINITIALIZED, kNoExtraICState) \
168 V(TailCallBoundFunction, BUILTIN, UNINITIALIZED, kNoExtraICState) \
163 V(Call_ReceiverIsNullOrUndefined, BUILTIN, UNINITIALIZED, kNoExtraICState) \ 169 V(Call_ReceiverIsNullOrUndefined, BUILTIN, UNINITIALIZED, kNoExtraICState) \
164 V(Call_ReceiverIsNotNullOrUndefined, BUILTIN, UNINITIALIZED, \ 170 V(Call_ReceiverIsNotNullOrUndefined, BUILTIN, UNINITIALIZED, \
165 kNoExtraICState) \ 171 kNoExtraICState) \
166 V(Call_ReceiverIsAny, BUILTIN, UNINITIALIZED, kNoExtraICState) \ 172 V(Call_ReceiverIsAny, BUILTIN, UNINITIALIZED, kNoExtraICState) \
173 V(TailCall_ReceiverIsNullOrUndefined, BUILTIN, UNINITIALIZED, \
174 kNoExtraICState) \
175 V(TailCall_ReceiverIsNotNullOrUndefined, BUILTIN, UNINITIALIZED, \
176 kNoExtraICState) \
177 V(TailCall_ReceiverIsAny, BUILTIN, UNINITIALIZED, kNoExtraICState) \
167 \ 178 \
168 V(ConstructFunction, BUILTIN, UNINITIALIZED, kNoExtraICState) \ 179 V(ConstructFunction, BUILTIN, UNINITIALIZED, kNoExtraICState) \
169 V(ConstructBoundFunction, BUILTIN, UNINITIALIZED, kNoExtraICState) \ 180 V(ConstructBoundFunction, BUILTIN, UNINITIALIZED, kNoExtraICState) \
170 V(ConstructProxy, BUILTIN, UNINITIALIZED, kNoExtraICState) \ 181 V(ConstructProxy, BUILTIN, UNINITIALIZED, kNoExtraICState) \
171 V(Construct, BUILTIN, UNINITIALIZED, kNoExtraICState) \ 182 V(Construct, BUILTIN, UNINITIALIZED, kNoExtraICState) \
172 \ 183 \
173 V(Apply, BUILTIN, UNINITIALIZED, kNoExtraICState) \ 184 V(Apply, BUILTIN, UNINITIALIZED, kNoExtraICState) \
174 \ 185 \
175 V(HandleFastApiCall, BUILTIN, UNINITIALIZED, kNoExtraICState) \ 186 V(HandleFastApiCall, BUILTIN, UNINITIALIZED, kNoExtraICState) \
176 \ 187 \
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 Handle<Code> name(); 343 Handle<Code> name();
333 #define DECLARE_BUILTIN_ACCESSOR_H(name, kind) Handle<Code> name(); 344 #define DECLARE_BUILTIN_ACCESSOR_H(name, kind) Handle<Code> name();
334 BUILTIN_LIST_C(DECLARE_BUILTIN_ACCESSOR_C) 345 BUILTIN_LIST_C(DECLARE_BUILTIN_ACCESSOR_C)
335 BUILTIN_LIST_A(DECLARE_BUILTIN_ACCESSOR_A) 346 BUILTIN_LIST_A(DECLARE_BUILTIN_ACCESSOR_A)
336 BUILTIN_LIST_H(DECLARE_BUILTIN_ACCESSOR_H) 347 BUILTIN_LIST_H(DECLARE_BUILTIN_ACCESSOR_H)
337 BUILTIN_LIST_DEBUG_A(DECLARE_BUILTIN_ACCESSOR_A) 348 BUILTIN_LIST_DEBUG_A(DECLARE_BUILTIN_ACCESSOR_A)
338 #undef DECLARE_BUILTIN_ACCESSOR_C 349 #undef DECLARE_BUILTIN_ACCESSOR_C
339 #undef DECLARE_BUILTIN_ACCESSOR_A 350 #undef DECLARE_BUILTIN_ACCESSOR_A
340 351
341 // Convenience wrappers. 352 // Convenience wrappers.
342 Handle<Code> CallFunction(ConvertReceiverMode = ConvertReceiverMode::kAny); 353 Handle<Code> CallFunction(
343 Handle<Code> Call(ConvertReceiverMode = ConvertReceiverMode::kAny); 354 ConvertReceiverMode = ConvertReceiverMode::kAny,
355 TailCallMode tail_call_mode = TailCallMode::kDisallow);
356 Handle<Code> Call(ConvertReceiverMode = ConvertReceiverMode::kAny,
357 TailCallMode tail_call_mode = TailCallMode::kDisallow);
358 Handle<Code> CallBoundFunction(TailCallMode tail_call_mode);
344 359
345 Code* builtin(Name name) { 360 Code* builtin(Name name) {
346 // Code::cast cannot be used here since we access builtins 361 // Code::cast cannot be used here since we access builtins
347 // during the marking phase of mark sweep. See IC::Clear. 362 // during the marking phase of mark sweep. See IC::Clear.
348 return reinterpret_cast<Code*>(builtins_[name]); 363 return reinterpret_cast<Code*>(builtins_[name]);
349 } 364 }
350 365
351 Address builtin_address(Name name) { 366 Address builtin_address(Name name) {
352 return reinterpret_cast<Address>(&builtins_[name]); 367 return reinterpret_cast<Address>(&builtins_[name]);
353 } 368 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 static void Generate_NotifySoftDeoptimized(MacroAssembler* masm); 413 static void Generate_NotifySoftDeoptimized(MacroAssembler* masm);
399 static void Generate_NotifyLazyDeoptimized(MacroAssembler* masm); 414 static void Generate_NotifyLazyDeoptimized(MacroAssembler* masm);
400 static void Generate_NotifyStubFailure(MacroAssembler* masm); 415 static void Generate_NotifyStubFailure(MacroAssembler* masm);
401 static void Generate_NotifyStubFailureSaveDoubles(MacroAssembler* masm); 416 static void Generate_NotifyStubFailureSaveDoubles(MacroAssembler* masm);
402 static void Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm); 417 static void Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm);
403 418
404 static void Generate_Apply(MacroAssembler* masm); 419 static void Generate_Apply(MacroAssembler* masm);
405 420
406 // ES6 section 9.2.1 [[Call]] ( thisArgument, argumentsList) 421 // ES6 section 9.2.1 [[Call]] ( thisArgument, argumentsList)
407 static void Generate_CallFunction(MacroAssembler* masm, 422 static void Generate_CallFunction(MacroAssembler* masm,
408 ConvertReceiverMode mode); 423 ConvertReceiverMode mode,
424 TailCallMode tail_call_mode);
409 static void Generate_CallFunction_ReceiverIsNullOrUndefined( 425 static void Generate_CallFunction_ReceiverIsNullOrUndefined(
410 MacroAssembler* masm) { 426 MacroAssembler* masm) {
411 Generate_CallFunction(masm, ConvertReceiverMode::kNullOrUndefined); 427 Generate_CallFunction(masm, ConvertReceiverMode::kNullOrUndefined,
428 TailCallMode::kDisallow);
412 } 429 }
413 static void Generate_CallFunction_ReceiverIsNotNullOrUndefined( 430 static void Generate_CallFunction_ReceiverIsNotNullOrUndefined(
414 MacroAssembler* masm) { 431 MacroAssembler* masm) {
415 Generate_CallFunction(masm, ConvertReceiverMode::kNotNullOrUndefined); 432 Generate_CallFunction(masm, ConvertReceiverMode::kNotNullOrUndefined,
433 TailCallMode::kDisallow);
416 } 434 }
417 static void Generate_CallFunction_ReceiverIsAny(MacroAssembler* masm) { 435 static void Generate_CallFunction_ReceiverIsAny(MacroAssembler* masm) {
418 Generate_CallFunction(masm, ConvertReceiverMode::kAny); 436 Generate_CallFunction(masm, ConvertReceiverMode::kAny,
437 TailCallMode::kDisallow);
438 }
439 static void Generate_TailCallFunction_ReceiverIsNullOrUndefined(
440 MacroAssembler* masm) {
441 Generate_CallFunction(masm, ConvertReceiverMode::kNullOrUndefined,
442 TailCallMode::kAllow);
443 }
444 static void Generate_TailCallFunction_ReceiverIsNotNullOrUndefined(
445 MacroAssembler* masm) {
446 Generate_CallFunction(masm, ConvertReceiverMode::kNotNullOrUndefined,
447 TailCallMode::kAllow);
448 }
449 static void Generate_TailCallFunction_ReceiverIsAny(MacroAssembler* masm) {
450 Generate_CallFunction(masm, ConvertReceiverMode::kAny,
451 TailCallMode::kAllow);
419 } 452 }
420 // ES6 section 9.4.1.1 [[Call]] ( thisArgument, argumentsList) 453 // ES6 section 9.4.1.1 [[Call]] ( thisArgument, argumentsList)
421 static void Generate_CallBoundFunction(MacroAssembler* masm); 454 static void Generate_CallBoundFunctionImpl(MacroAssembler* masm,
455 TailCallMode tail_call_mode);
456 static void Generate_CallBoundFunction(MacroAssembler* masm) {
457 Generate_CallBoundFunctionImpl(masm, TailCallMode::kDisallow);
458 }
459 static void Generate_TailCallBoundFunction(MacroAssembler* masm) {
460 Generate_CallBoundFunctionImpl(masm, TailCallMode::kAllow);
461 }
422 // ES6 section 7.3.12 Call(F, V, [argumentsList]) 462 // ES6 section 7.3.12 Call(F, V, [argumentsList])
423 static void Generate_Call(MacroAssembler* masm, ConvertReceiverMode mode); 463 static void Generate_Call(MacroAssembler* masm, ConvertReceiverMode mode,
464 TailCallMode tail_call_mode);
424 static void Generate_Call_ReceiverIsNullOrUndefined(MacroAssembler* masm) { 465 static void Generate_Call_ReceiverIsNullOrUndefined(MacroAssembler* masm) {
425 Generate_Call(masm, ConvertReceiverMode::kNullOrUndefined); 466 Generate_Call(masm, ConvertReceiverMode::kNullOrUndefined,
467 TailCallMode::kDisallow);
426 } 468 }
427 static void Generate_Call_ReceiverIsNotNullOrUndefined(MacroAssembler* masm) { 469 static void Generate_Call_ReceiverIsNotNullOrUndefined(MacroAssembler* masm) {
428 Generate_Call(masm, ConvertReceiverMode::kNotNullOrUndefined); 470 Generate_Call(masm, ConvertReceiverMode::kNotNullOrUndefined,
471 TailCallMode::kDisallow);
429 } 472 }
430 static void Generate_Call_ReceiverIsAny(MacroAssembler* masm) { 473 static void Generate_Call_ReceiverIsAny(MacroAssembler* masm) {
431 Generate_Call(masm, ConvertReceiverMode::kAny); 474 Generate_Call(masm, ConvertReceiverMode::kAny, TailCallMode::kDisallow);
475 }
476 static void Generate_TailCall_ReceiverIsNullOrUndefined(
477 MacroAssembler* masm) {
478 Generate_Call(masm, ConvertReceiverMode::kNullOrUndefined,
479 TailCallMode::kAllow);
480 }
481 static void Generate_TailCall_ReceiverIsNotNullOrUndefined(
482 MacroAssembler* masm) {
483 Generate_Call(masm, ConvertReceiverMode::kNotNullOrUndefined,
484 TailCallMode::kAllow);
485 }
486 static void Generate_TailCall_ReceiverIsAny(MacroAssembler* masm) {
487 Generate_Call(masm, ConvertReceiverMode::kAny, TailCallMode::kAllow);
432 } 488 }
433 489
434 // ES6 section 9.2.2 [[Construct]] ( argumentsList, newTarget) 490 // ES6 section 9.2.2 [[Construct]] ( argumentsList, newTarget)
435 static void Generate_ConstructFunction(MacroAssembler* masm); 491 static void Generate_ConstructFunction(MacroAssembler* masm);
436 // ES6 section 9.4.1.2 [[Construct]] (argumentsList, newTarget) 492 // ES6 section 9.4.1.2 [[Construct]] (argumentsList, newTarget)
437 static void Generate_ConstructBoundFunction(MacroAssembler* masm); 493 static void Generate_ConstructBoundFunction(MacroAssembler* masm);
438 // ES6 section 9.5.14 [[Construct]] ( argumentsList, newTarget) 494 // ES6 section 9.5.14 [[Construct]] ( argumentsList, newTarget)
439 static void Generate_ConstructProxy(MacroAssembler* masm); 495 static void Generate_ConstructProxy(MacroAssembler* masm);
440 // ES6 section 7.3.13 Construct (F, [argumentsList], [newTarget]) 496 // ES6 section 7.3.13 Construct (F, [argumentsList], [newTarget])
441 static void Generate_Construct(MacroAssembler* masm); 497 static void Generate_Construct(MacroAssembler* masm);
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 friend class BuiltinFunctionTable; 586 friend class BuiltinFunctionTable;
531 friend class Isolate; 587 friend class Isolate;
532 588
533 DISALLOW_COPY_AND_ASSIGN(Builtins); 589 DISALLOW_COPY_AND_ASSIGN(Builtins);
534 }; 590 };
535 591
536 } // namespace internal 592 } // namespace internal
537 } // namespace v8 593 } // namespace v8
538 594
539 #endif // V8_BUILTINS_H_ 595 #endif // V8_BUILTINS_H_
OLDNEW
« no previous file with comments | « src/bootstrapper.cc ('k') | src/builtins.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698