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

Side by Side Diff: src/arm/builtins-arm.cc

Issue 2840018: [Isolates] Moved more compilation-related globals (builtins, runtime, &c.)... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: rebase Created 10 years, 5 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/api.cc ('k') | src/arm/codegen-arm.h » ('j') | src/runtime.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 __ CompareObjectType(r2, r3, r4, MAP_TYPE); 433 __ CompareObjectType(r2, r3, r4, MAP_TYPE);
434 __ Assert(eq, "Unexpected initial map for Array function"); 434 __ Assert(eq, "Unexpected initial map for Array function");
435 } 435 }
436 436
437 // Run the native code for the Array function called as a normal function. 437 // Run the native code for the Array function called as a normal function.
438 ArrayNativeCode(masm, &generic_array_code); 438 ArrayNativeCode(masm, &generic_array_code);
439 439
440 // Jump to the generic array code if the specialized code cannot handle 440 // Jump to the generic array code if the specialized code cannot handle
441 // the construction. 441 // the construction.
442 __ bind(&generic_array_code); 442 __ bind(&generic_array_code);
443 Code* code = Builtins::builtin(Builtins::ArrayCodeGeneric); 443 Code* code = Isolate::Current()->builtins()->builtin(
444 Builtins::ArrayCodeGeneric);
444 Handle<Code> array_code(code); 445 Handle<Code> array_code(code);
445 __ Jump(array_code, RelocInfo::CODE_TARGET); 446 __ Jump(array_code, RelocInfo::CODE_TARGET);
446 } 447 }
447 448
448 449
449 void Builtins::Generate_ArrayConstructCode(MacroAssembler* masm) { 450 void Builtins::Generate_ArrayConstructCode(MacroAssembler* masm) {
450 // ----------- S t a t e ------------- 451 // ----------- S t a t e -------------
451 // -- r0 : number of arguments 452 // -- r0 : number of arguments
452 // -- r1 : constructor function 453 // -- r1 : constructor function
453 // -- lr : return address 454 // -- lr : return address
(...skipping 14 matching lines...) Expand all
468 __ CompareObjectType(r2, r3, r4, MAP_TYPE); 469 __ CompareObjectType(r2, r3, r4, MAP_TYPE);
469 __ Assert(eq, "Unexpected initial map for Array function"); 470 __ Assert(eq, "Unexpected initial map for Array function");
470 } 471 }
471 472
472 // Run the native code for the Array function called as a constructor. 473 // Run the native code for the Array function called as a constructor.
473 ArrayNativeCode(masm, &generic_constructor); 474 ArrayNativeCode(masm, &generic_constructor);
474 475
475 // Jump to the generic construct code in case the specialized code cannot 476 // Jump to the generic construct code in case the specialized code cannot
476 // handle the construction. 477 // handle the construction.
477 __ bind(&generic_constructor); 478 __ bind(&generic_constructor);
478 Code* code = Builtins::builtin(Builtins::JSConstructStubGeneric); 479 Code* code = Isolate::Current()->builtins()->builtin(
480 Builtins::JSConstructStubGeneric);
479 Handle<Code> generic_construct_stub(code); 481 Handle<Code> generic_construct_stub(code);
480 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); 482 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET);
481 } 483 }
482 484
483 485
484 void Builtins::Generate_JSConstructCall(MacroAssembler* masm) { 486 void Builtins::Generate_JSConstructCall(MacroAssembler* masm) {
485 // ----------- S t a t e ------------- 487 // ----------- S t a t e -------------
486 // -- r0 : number of arguments 488 // -- r0 : number of arguments
487 // -- r1 : constructor function 489 // -- r1 : constructor function
488 // -- lr : return address 490 // -- lr : return address
(...skipping 16 matching lines...) Expand all
505 // r0: number of arguments 507 // r0: number of arguments
506 // r1: called object 508 // r1: called object
507 __ bind(&non_function_call); 509 __ bind(&non_function_call);
508 // CALL_NON_FUNCTION expects the non-function constructor as receiver 510 // CALL_NON_FUNCTION expects the non-function constructor as receiver
509 // (instead of the original receiver from the call site). The receiver is 511 // (instead of the original receiver from the call site). The receiver is
510 // stack element argc. 512 // stack element argc.
511 __ str(r1, MemOperand(sp, r0, LSL, kPointerSizeLog2)); 513 __ str(r1, MemOperand(sp, r0, LSL, kPointerSizeLog2));
512 // Set expected number of arguments to zero (not changing r0). 514 // Set expected number of arguments to zero (not changing r0).
513 __ mov(r2, Operand(0)); 515 __ mov(r2, Operand(0));
514 __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR); 516 __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR);
515 __ Jump(Handle<Code>(builtin(ArgumentsAdaptorTrampoline)), 517 __ Jump(Handle<Code>(Isolate::Current()->builtins()->builtin(
516 RelocInfo::CODE_TARGET); 518 ArgumentsAdaptorTrampoline)), RelocInfo::CODE_TARGET);
517 } 519 }
518 520
519 521
520 static void Generate_JSConstructStubHelper(MacroAssembler* masm, 522 static void Generate_JSConstructStubHelper(MacroAssembler* masm,
521 bool is_api_function) { 523 bool is_api_function) {
522 // Enter a construct frame. 524 // Enter a construct frame.
523 __ EnterConstructFrame(); 525 __ EnterConstructFrame();
524 526
525 // Preserve the two incoming parameters on the stack. 527 // Preserve the two incoming parameters on the stack.
526 __ mov(r0, Operand(r0, LSL, kSmiTagSize)); 528 __ mov(r0, Operand(r0, LSL, kSmiTagSize));
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 __ bind(&entry); 752 __ bind(&entry);
751 __ sub(r3, r3, Operand(2), SetCC); 753 __ sub(r3, r3, Operand(2), SetCC);
752 __ b(ge, &loop); 754 __ b(ge, &loop);
753 755
754 // Call the function. 756 // Call the function.
755 // r0: number of arguments 757 // r0: number of arguments
756 // r1: constructor function 758 // r1: constructor function
757 if (is_api_function) { 759 if (is_api_function) {
758 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); 760 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset));
759 Handle<Code> code = Handle<Code>( 761 Handle<Code> code = Handle<Code>(
760 Builtins::builtin(Builtins::HandleApiCallConstruct)); 762 Isolate::Current()->builtins()->builtin(
763 Builtins::HandleApiCallConstruct));
761 ParameterCount expected(0); 764 ParameterCount expected(0);
762 __ InvokeCode(code, expected, expected, 765 __ InvokeCode(code, expected, expected,
763 RelocInfo::CODE_TARGET, CALL_FUNCTION); 766 RelocInfo::CODE_TARGET, CALL_FUNCTION);
764 } else { 767 } else {
765 ParameterCount actual(r0); 768 ParameterCount actual(r0);
766 __ InvokeFunction(r1, actual, CALL_FUNCTION); 769 __ InvokeFunction(r1, actual, CALL_FUNCTION);
767 } 770 }
768 771
769 // Pop the function from the stack. 772 // Pop the function from the stack.
770 // sp[0]: constructor function 773 // sp[0]: constructor function
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
878 __ mov(r5, Operand(r4)); 881 __ mov(r5, Operand(r4));
879 __ mov(r6, Operand(r4)); 882 __ mov(r6, Operand(r4));
880 __ mov(r7, Operand(r4)); 883 __ mov(r7, Operand(r4));
881 if (kR9Available == 1) { 884 if (kR9Available == 1) {
882 __ mov(r9, Operand(r4)); 885 __ mov(r9, Operand(r4));
883 } 886 }
884 887
885 // Invoke the code and pass argc as r0. 888 // Invoke the code and pass argc as r0.
886 __ mov(r0, Operand(r3)); 889 __ mov(r0, Operand(r3));
887 if (is_construct) { 890 if (is_construct) {
888 __ Call(Handle<Code>(Builtins::builtin(Builtins::JSConstructCall)), 891 __ Call(Handle<Code>(Isolate::Current()->builtins()->builtin(
889 RelocInfo::CODE_TARGET); 892 Builtins::JSConstructCall)), RelocInfo::CODE_TARGET);
890 } else { 893 } else {
891 ParameterCount actual(r0); 894 ParameterCount actual(r0);
892 __ InvokeFunction(r1, actual, CALL_FUNCTION); 895 __ InvokeFunction(r1, actual, CALL_FUNCTION);
893 } 896 }
894 897
895 // Exit the JS frame and remove the parameters (except function), and return. 898 // Exit the JS frame and remove the parameters (except function), and return.
896 // Respect ABI stack constraint. 899 // Respect ABI stack constraint.
897 __ LeaveInternalFrame(); 900 __ LeaveInternalFrame();
898 __ Jump(lr); 901 __ Jump(lr);
899 902
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
1029 } 1032 }
1030 1033
1031 // 5a. Call non-function via tail call to CALL_NON_FUNCTION builtin. 1034 // 5a. Call non-function via tail call to CALL_NON_FUNCTION builtin.
1032 // r0: actual number of arguments 1035 // r0: actual number of arguments
1033 // r1: function 1036 // r1: function
1034 { Label function; 1037 { Label function;
1035 __ tst(r1, r1); 1038 __ tst(r1, r1);
1036 __ b(ne, &function); 1039 __ b(ne, &function);
1037 __ mov(r2, Operand(0)); // expected arguments is 0 for CALL_NON_FUNCTION 1040 __ mov(r2, Operand(0)); // expected arguments is 0 for CALL_NON_FUNCTION
1038 __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION); 1041 __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION);
1039 __ Jump(Handle<Code>(builtin(ArgumentsAdaptorTrampoline)), 1042 __ Jump(Handle<Code>(Isolate::Current()->builtins()->builtin(
1040 RelocInfo::CODE_TARGET); 1043 ArgumentsAdaptorTrampoline)), RelocInfo::CODE_TARGET);
1041 __ bind(&function); 1044 __ bind(&function);
1042 } 1045 }
1043 1046
1044 // 5b. Get the code to call from the function and check that the number of 1047 // 5b. Get the code to call from the function and check that the number of
1045 // expected arguments matches what we're providing. If so, jump 1048 // expected arguments matches what we're providing. If so, jump
1046 // (tail-call) to the code in register edx without checking arguments. 1049 // (tail-call) to the code in register edx without checking arguments.
1047 // r0: actual number of arguments 1050 // r0: actual number of arguments
1048 // r1: function 1051 // r1: function
1049 __ ldr(r3, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); 1052 __ ldr(r3, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset));
1050 __ ldr(r2, 1053 __ ldr(r2,
1051 FieldMemOperand(r3, SharedFunctionInfo::kFormalParameterCountOffset)); 1054 FieldMemOperand(r3, SharedFunctionInfo::kFormalParameterCountOffset));
1052 __ mov(r2, Operand(r2, ASR, kSmiTagSize)); 1055 __ mov(r2, Operand(r2, ASR, kSmiTagSize));
1053 __ ldr(r3, FieldMemOperand(r3, SharedFunctionInfo::kCodeOffset)); 1056 __ ldr(r3, FieldMemOperand(r3, SharedFunctionInfo::kCodeOffset));
1054 __ add(r3, r3, Operand(Code::kHeaderSize - kHeapObjectTag)); 1057 __ add(r3, r3, Operand(Code::kHeaderSize - kHeapObjectTag));
1055 __ cmp(r2, r0); // Check formal and actual parameter counts. 1058 __ cmp(r2, r0); // Check formal and actual parameter counts.
1056 __ Jump(Handle<Code>(builtin(ArgumentsAdaptorTrampoline)), 1059 __ Jump(Handle<Code>(Isolate::Current()->builtins()->builtin(
1057 RelocInfo::CODE_TARGET, ne); 1060 ArgumentsAdaptorTrampoline)), RelocInfo::CODE_TARGET, ne);
1058 1061
1059 ParameterCount expected(0); 1062 ParameterCount expected(0);
1060 __ InvokeCode(r3, expected, expected, JUMP_FUNCTION); 1063 __ InvokeCode(r3, expected, expected, JUMP_FUNCTION);
1061 } 1064 }
1062 1065
1063 1066
1064 void Builtins::Generate_FunctionApply(MacroAssembler* masm) { 1067 void Builtins::Generate_FunctionApply(MacroAssembler* masm) {
1065 const int kIndexOffset = -5 * kPointerSize; 1068 const int kIndexOffset = -5 * kPointerSize;
1066 const int kLimitOffset = -4 * kPointerSize; 1069 const int kLimitOffset = -4 * kPointerSize;
1067 const int kArgsOffset = 2 * kPointerSize; 1070 const int kArgsOffset = 2 * kPointerSize;
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
1311 __ bind(&dont_adapt_arguments); 1314 __ bind(&dont_adapt_arguments);
1312 __ Jump(r3); 1315 __ Jump(r3);
1313 } 1316 }
1314 1317
1315 1318
1316 #undef __ 1319 #undef __
1317 1320
1318 } } // namespace v8::internal 1321 } } // namespace v8::internal
1319 1322
1320 #endif // V8_TARGET_ARCH_ARM 1323 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/arm/codegen-arm.h » ('j') | src/runtime.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698