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

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

Issue 6717018: Introduce accessors on builtins instance (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix tests and lint. Created 9 years, 9 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 | « no previous file | src/arm/code-stubs-arm.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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 __ CompareObjectType(r2, r3, r4, MAP_TYPE); 436 __ CompareObjectType(r2, r3, r4, MAP_TYPE);
437 __ Assert(eq, "Unexpected initial map for Array function"); 437 __ Assert(eq, "Unexpected initial map for Array function");
438 } 438 }
439 439
440 // Run the native code for the Array function called as a normal function. 440 // Run the native code for the Array function called as a normal function.
441 ArrayNativeCode(masm, &generic_array_code); 441 ArrayNativeCode(masm, &generic_array_code);
442 442
443 // Jump to the generic array code if the specialized code cannot handle 443 // Jump to the generic array code if the specialized code cannot handle
444 // the construction. 444 // the construction.
445 __ bind(&generic_array_code); 445 __ bind(&generic_array_code);
446 Code* code = masm->isolate()->builtins()->builtin( 446
447 Builtins::ArrayCodeGeneric); 447 Handle<Code> array_code =
448 Handle<Code> array_code(code); 448 masm->isolate()->builtins()->ArrayCodeGeneric();
449 __ Jump(array_code, RelocInfo::CODE_TARGET); 449 __ Jump(array_code, RelocInfo::CODE_TARGET);
450 } 450 }
451 451
452 452
453 void Builtins::Generate_ArrayConstructCode(MacroAssembler* masm) { 453 void Builtins::Generate_ArrayConstructCode(MacroAssembler* masm) {
454 // ----------- S t a t e ------------- 454 // ----------- S t a t e -------------
455 // -- r0 : number of arguments 455 // -- r0 : number of arguments
456 // -- r1 : constructor function 456 // -- r1 : constructor function
457 // -- lr : return address 457 // -- lr : return address
458 // -- sp[...]: constructor arguments 458 // -- sp[...]: constructor arguments
(...skipping 10 matching lines...) Expand all
469 __ CompareObjectType(r2, r3, r4, MAP_TYPE); 469 __ CompareObjectType(r2, r3, r4, MAP_TYPE);
470 __ Assert(eq, "Unexpected initial map for Array function"); 470 __ Assert(eq, "Unexpected initial map for Array function");
471 } 471 }
472 472
473 // 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.
474 ArrayNativeCode(masm, &generic_constructor); 474 ArrayNativeCode(masm, &generic_constructor);
475 475
476 // 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
477 // handle the construction. 477 // handle the construction.
478 __ bind(&generic_constructor); 478 __ bind(&generic_constructor);
479 Code* code = masm->isolate()->builtins()->builtin( 479 Handle<Code> generic_construct_stub =
480 Builtins::JSConstructStubGeneric); 480 masm->isolate()->builtins()->JSConstructStubGeneric();
481 Handle<Code> generic_construct_stub(code);
482 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); 481 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET);
483 } 482 }
484 483
485 484
486 void Builtins::Generate_StringConstructCode(MacroAssembler* masm) { 485 void Builtins::Generate_StringConstructCode(MacroAssembler* masm) {
487 // ----------- S t a t e ------------- 486 // ----------- S t a t e -------------
488 // -- r0 : number of arguments 487 // -- r0 : number of arguments
489 // -- r1 : constructor function 488 // -- r1 : constructor function
490 // -- lr : return address 489 // -- lr : return address
491 // -- sp[(argc - n - 1) * 4] : arg[n] (zero based) 490 // -- sp[(argc - n - 1) * 4] : arg[n] (zero based)
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 __ ldr(r2, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); 629 __ ldr(r2, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset));
631 __ ldr(r2, FieldMemOperand(r2, SharedFunctionInfo::kConstructStubOffset)); 630 __ ldr(r2, FieldMemOperand(r2, SharedFunctionInfo::kConstructStubOffset));
632 __ add(pc, r2, Operand(Code::kHeaderSize - kHeapObjectTag)); 631 __ add(pc, r2, Operand(Code::kHeaderSize - kHeapObjectTag));
633 632
634 // r0: number of arguments 633 // r0: number of arguments
635 // r1: called object 634 // r1: called object
636 __ bind(&non_function_call); 635 __ bind(&non_function_call);
637 // Set expected number of arguments to zero (not changing r0). 636 // Set expected number of arguments to zero (not changing r0).
638 __ mov(r2, Operand(0, RelocInfo::NONE)); 637 __ mov(r2, Operand(0, RelocInfo::NONE));
639 __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR); 638 __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR);
640 __ Jump(Handle<Code>(masm->isolate()->builtins()->builtin( 639 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
641 ArgumentsAdaptorTrampoline)), RelocInfo::CODE_TARGET); 640 RelocInfo::CODE_TARGET);
642 } 641 }
643 642
644 643
645 static void Generate_JSConstructStubHelper(MacroAssembler* masm, 644 static void Generate_JSConstructStubHelper(MacroAssembler* masm,
646 bool is_api_function, 645 bool is_api_function,
647 bool count_constructions) { 646 bool count_constructions) {
648 // Should never count constructions for api objects. 647 // Should never count constructions for api objects.
649 ASSERT(!is_api_function || !count_constructions); 648 ASSERT(!is_api_function || !count_constructions);
650 649
651 Isolate* isolate = masm->isolate(); 650 Isolate* isolate = masm->isolate();
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
904 __ push(ip); 903 __ push(ip);
905 __ bind(&entry); 904 __ bind(&entry);
906 __ sub(r3, r3, Operand(2), SetCC); 905 __ sub(r3, r3, Operand(2), SetCC);
907 __ b(ge, &loop); 906 __ b(ge, &loop);
908 907
909 // Call the function. 908 // Call the function.
910 // r0: number of arguments 909 // r0: number of arguments
911 // r1: constructor function 910 // r1: constructor function
912 if (is_api_function) { 911 if (is_api_function) {
913 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); 912 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset));
914 Handle<Code> code = Handle<Code>( 913 Handle<Code> code =
915 isolate->builtins()->builtin(Builtins::HandleApiCallConstruct)); 914 masm->isolate()->builtins()->HandleApiCallConstruct();
916 ParameterCount expected(0); 915 ParameterCount expected(0);
917 __ InvokeCode(code, expected, expected, 916 __ InvokeCode(code, expected, expected,
918 RelocInfo::CODE_TARGET, CALL_FUNCTION); 917 RelocInfo::CODE_TARGET, CALL_FUNCTION);
919 } else { 918 } else {
920 ParameterCount actual(r0); 919 ParameterCount actual(r0);
921 __ InvokeFunction(r1, actual, CALL_FUNCTION); 920 __ InvokeFunction(r1, actual, CALL_FUNCTION);
922 } 921 }
923 922
924 // Pop the function from the stack. 923 // Pop the function from the stack.
925 // sp[0]: constructor function 924 // sp[0]: constructor function
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1039 __ mov(r5, Operand(r4)); 1038 __ mov(r5, Operand(r4));
1040 __ mov(r6, Operand(r4)); 1039 __ mov(r6, Operand(r4));
1041 __ mov(r7, Operand(r4)); 1040 __ mov(r7, Operand(r4));
1042 if (kR9Available == 1) { 1041 if (kR9Available == 1) {
1043 __ mov(r9, Operand(r4)); 1042 __ mov(r9, Operand(r4));
1044 } 1043 }
1045 1044
1046 // Invoke the code and pass argc as r0. 1045 // Invoke the code and pass argc as r0.
1047 __ mov(r0, Operand(r3)); 1046 __ mov(r0, Operand(r3));
1048 if (is_construct) { 1047 if (is_construct) {
1049 __ Call(Handle<Code>(masm->isolate()->builtins()->builtin( 1048 __ Call(masm->isolate()->builtins()->JSConstructCall(),
1050 Builtins::JSConstructCall)), RelocInfo::CODE_TARGET); 1049 RelocInfo::CODE_TARGET);
1051 } else { 1050 } else {
1052 ParameterCount actual(r0); 1051 ParameterCount actual(r0);
1053 __ InvokeFunction(r1, actual, CALL_FUNCTION); 1052 __ InvokeFunction(r1, actual, CALL_FUNCTION);
1054 } 1053 }
1055 1054
1056 // Exit the JS frame and remove the parameters (except function), and return. 1055 // Exit the JS frame and remove the parameters (except function), and return.
1057 // Respect ABI stack constraint. 1056 // Respect ABI stack constraint.
1058 __ LeaveInternalFrame(); 1057 __ LeaveInternalFrame();
1059 __ Jump(lr); 1058 __ Jump(lr);
1060 1059
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
1332 1331
1333 // 5a. Call non-function via tail call to CALL_NON_FUNCTION builtin. 1332 // 5a. Call non-function via tail call to CALL_NON_FUNCTION builtin.
1334 // r0: actual number of arguments 1333 // r0: actual number of arguments
1335 // r1: function 1334 // r1: function
1336 { Label function; 1335 { Label function;
1337 __ tst(r1, r1); 1336 __ tst(r1, r1);
1338 __ b(ne, &function); 1337 __ b(ne, &function);
1339 // Expected number of arguments is 0 for CALL_NON_FUNCTION. 1338 // Expected number of arguments is 0 for CALL_NON_FUNCTION.
1340 __ mov(r2, Operand(0, RelocInfo::NONE)); 1339 __ mov(r2, Operand(0, RelocInfo::NONE));
1341 __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION); 1340 __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION);
1342 __ Jump(Handle<Code>(masm->isolate()->builtins()->builtin( 1341 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
1343 ArgumentsAdaptorTrampoline)), RelocInfo::CODE_TARGET); 1342 RelocInfo::CODE_TARGET);
1344 __ bind(&function); 1343 __ bind(&function);
1345 } 1344 }
1346 1345
1347 // 5b. Get the code to call from the function and check that the number of 1346 // 5b. Get the code to call from the function and check that the number of
1348 // expected arguments matches what we're providing. If so, jump 1347 // expected arguments matches what we're providing. If so, jump
1349 // (tail-call) to the code in register edx without checking arguments. 1348 // (tail-call) to the code in register edx without checking arguments.
1350 // r0: actual number of arguments 1349 // r0: actual number of arguments
1351 // r1: function 1350 // r1: function
1352 __ ldr(r3, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); 1351 __ ldr(r3, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset));
1353 __ ldr(r2, 1352 __ ldr(r2,
1354 FieldMemOperand(r3, SharedFunctionInfo::kFormalParameterCountOffset)); 1353 FieldMemOperand(r3, SharedFunctionInfo::kFormalParameterCountOffset));
1355 __ mov(r2, Operand(r2, ASR, kSmiTagSize)); 1354 __ mov(r2, Operand(r2, ASR, kSmiTagSize));
1356 __ ldr(r3, FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); 1355 __ ldr(r3, FieldMemOperand(r1, JSFunction::kCodeEntryOffset));
1357 __ cmp(r2, r0); // Check formal and actual parameter counts. 1356 __ cmp(r2, r0); // Check formal and actual parameter counts.
1358 __ Jump(Handle<Code>(masm->isolate()->builtins()->builtin( 1357 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
1359 ArgumentsAdaptorTrampoline)), RelocInfo::CODE_TARGET, ne); 1358 RelocInfo::CODE_TARGET,
1359 ne);
1360 1360
1361 ParameterCount expected(0); 1361 ParameterCount expected(0);
1362 __ InvokeCode(r3, expected, expected, JUMP_FUNCTION); 1362 __ InvokeCode(r3, expected, expected, JUMP_FUNCTION);
1363 } 1363 }
1364 1364
1365 1365
1366 void Builtins::Generate_FunctionApply(MacroAssembler* masm) { 1366 void Builtins::Generate_FunctionApply(MacroAssembler* masm) {
1367 const int kIndexOffset = -5 * kPointerSize; 1367 const int kIndexOffset = -5 * kPointerSize;
1368 const int kLimitOffset = -4 * kPointerSize; 1368 const int kLimitOffset = -4 * kPointerSize;
1369 const int kArgsOffset = 2 * kPointerSize; 1369 const int kArgsOffset = 2 * kPointerSize;
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
1623 __ bind(&dont_adapt_arguments); 1623 __ bind(&dont_adapt_arguments);
1624 __ Jump(r3); 1624 __ Jump(r3);
1625 } 1625 }
1626 1626
1627 1627
1628 #undef __ 1628 #undef __
1629 1629
1630 } } // namespace v8::internal 1630 } } // namespace v8::internal
1631 1631
1632 #endif // V8_TARGET_ARCH_ARM 1632 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm/code-stubs-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698