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

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

Issue 7348008: Merge up to 8597 to experimental/gc from the bleeding edge. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: '' Created 9 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/mips/assembler-mips-inl.h ('k') | src/mips/code-stubs-mips.h » ('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 // 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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 __ Branch(&argc_two_or_more, ne, a0, Operand(1)); 337 __ Branch(&argc_two_or_more, ne, a0, Operand(1));
338 338
339 ASSERT(kSmiTag == 0); 339 ASSERT(kSmiTag == 0);
340 __ lw(a2, MemOperand(sp)); // Get the argument from the stack. 340 __ lw(a2, MemOperand(sp)); // Get the argument from the stack.
341 __ And(a3, a2, Operand(kIntptrSignBit | kSmiTagMask)); 341 __ And(a3, a2, Operand(kIntptrSignBit | kSmiTagMask));
342 __ Branch(call_generic_code, eq, a3, Operand(zero_reg)); 342 __ Branch(call_generic_code, eq, a3, Operand(zero_reg));
343 343
344 // Handle construction of an empty array of a certain size. Bail out if size 344 // Handle construction of an empty array of a certain size. Bail out if size
345 // is too large to actually allocate an elements array. 345 // is too large to actually allocate an elements array.
346 ASSERT(kSmiTag == 0); 346 ASSERT(kSmiTag == 0);
347 __ Branch(call_generic_code, ge, a2, 347 __ Branch(call_generic_code, Ugreater_equal, a2,
348 Operand(JSObject::kInitialMaxFastElementArray << kSmiTagSize)); 348 Operand(JSObject::kInitialMaxFastElementArray << kSmiTagSize));
349 349
350 // a0: argc 350 // a0: argc
351 // a1: constructor 351 // a1: constructor
352 // a2: array_size (smi) 352 // a2: array_size (smi)
353 // sp[0]: argument 353 // sp[0]: argument
354 AllocateJSArray(masm, 354 AllocateJSArray(masm,
355 a1, 355 a1,
356 a2, 356 a2,
357 a3, 357 a3,
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 __ And(t0, a1, Operand(kSmiTagMask)); 627 __ And(t0, a1, Operand(kSmiTagMask));
628 __ Branch(&non_function_call, eq, t0, Operand(zero_reg)); 628 __ Branch(&non_function_call, eq, t0, Operand(zero_reg));
629 // Check that the function is a JSFunction. 629 // Check that the function is a JSFunction.
630 __ GetObjectType(a1, a2, a2); 630 __ GetObjectType(a1, a2, a2);
631 __ Branch(&non_function_call, ne, a2, Operand(JS_FUNCTION_TYPE)); 631 __ Branch(&non_function_call, ne, a2, Operand(JS_FUNCTION_TYPE));
632 632
633 // Jump to the function-specific construct stub. 633 // Jump to the function-specific construct stub.
634 __ lw(a2, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); 634 __ lw(a2, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
635 __ lw(a2, FieldMemOperand(a2, SharedFunctionInfo::kConstructStubOffset)); 635 __ lw(a2, FieldMemOperand(a2, SharedFunctionInfo::kConstructStubOffset));
636 __ Addu(t9, a2, Operand(Code::kHeaderSize - kHeapObjectTag)); 636 __ Addu(t9, a2, Operand(Code::kHeaderSize - kHeapObjectTag));
637 __ Jump(Operand(t9)); 637 __ Jump(t9);
638 638
639 // a0: number of arguments 639 // a0: number of arguments
640 // a1: called object 640 // a1: called object
641 __ bind(&non_function_call); 641 __ bind(&non_function_call);
642 // CALL_NON_FUNCTION expects the non-function constructor as receiver 642 // CALL_NON_FUNCTION expects the non-function constructor as receiver
643 // (instead of the original receiver from the call site). The receiver is 643 // (instead of the original receiver from the call site). The receiver is
644 // stack element argc. 644 // stack element argc.
645 // Set expected number of arguments to zero (not changing a0). 645 // Set expected number of arguments to zero (not changing a0).
646 __ mov(a2, zero_reg); 646 __ mov(a2, zero_reg);
647 __ GetBuiltinEntry(a3, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR); 647 __ GetBuiltinEntry(a3, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR);
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
935 935
936 // Call the function. 936 // Call the function.
937 // a0: number of arguments 937 // a0: number of arguments
938 // a1: constructor function 938 // a1: constructor function
939 if (is_api_function) { 939 if (is_api_function) {
940 __ lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); 940 __ lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset));
941 Handle<Code> code = 941 Handle<Code> code =
942 masm->isolate()->builtins()->HandleApiCallConstruct(); 942 masm->isolate()->builtins()->HandleApiCallConstruct();
943 ParameterCount expected(0); 943 ParameterCount expected(0);
944 __ InvokeCode(code, expected, expected, 944 __ InvokeCode(code, expected, expected,
945 RelocInfo::CODE_TARGET, CALL_FUNCTION); 945 RelocInfo::CODE_TARGET, CALL_FUNCTION, CALL_AS_METHOD);
946 } else { 946 } else {
947 ParameterCount actual(a0); 947 ParameterCount actual(a0);
948 __ InvokeFunction(a1, actual, CALL_FUNCTION); 948 __ InvokeFunction(a1, actual, CALL_FUNCTION,
949 NullCallWrapper(), CALL_AS_METHOD);
949 } 950 }
950 951
951 // Pop the function from the stack. 952 // Pop the function from the stack.
952 // v0: result 953 // v0: result
953 // sp[0]: constructor function 954 // sp[0]: constructor function
954 // sp[2]: receiver 955 // sp[2]: receiver
955 // sp[3]: constructor function 956 // sp[3]: constructor function
956 // sp[4]: number of arguments (smi-tagged) 957 // sp[4]: number of arguments (smi-tagged)
957 __ Pop(); 958 __ Pop();
958 959
959 // Restore context from the frame. 960 // Restore context from the frame.
960 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 961 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
961 962
962 // If the result is an object (in the ECMA sense), we should get rid 963 // If the result is an object (in the ECMA sense), we should get rid
963 // of the receiver and use the result; see ECMA-262 section 13.2.2-7 964 // of the receiver and use the result; see ECMA-262 section 13.2.2-7
964 // on page 74. 965 // on page 74.
965 Label use_receiver, exit; 966 Label use_receiver, exit;
966 967
967 // If the result is a smi, it is *not* an object in the ECMA sense. 968 // If the result is a smi, it is *not* an object in the ECMA sense.
968 // v0: result 969 // v0: result
969 // sp[0]: receiver (newly allocated object) 970 // sp[0]: receiver (newly allocated object)
970 // sp[1]: constructor function 971 // sp[1]: constructor function
971 // sp[2]: number of arguments (smi-tagged) 972 // sp[2]: number of arguments (smi-tagged)
972 __ And(t0, v0, Operand(kSmiTagMask)); 973 __ And(t0, v0, Operand(kSmiTagMask));
973 __ Branch(&use_receiver, eq, t0, Operand(zero_reg)); 974 __ Branch(&use_receiver, eq, t0, Operand(zero_reg));
974 975
975 // If the type of the result (stored in its map) is less than 976 // If the type of the result (stored in its map) is less than
976 // FIRST_JS_OBJECT_TYPE, it is not an object in the ECMA sense. 977 // FIRST_SPEC_OBJECT_TYPE, it is not an object in the ECMA sense.
977 __ GetObjectType(v0, a3, a3); 978 __ GetObjectType(v0, a3, a3);
978 __ Branch(&exit, greater_equal, a3, Operand(FIRST_JS_OBJECT_TYPE)); 979 __ Branch(&exit, greater_equal, a3, Operand(FIRST_SPEC_OBJECT_TYPE));
979 980
980 // Throw away the result of the constructor invocation and use the 981 // Throw away the result of the constructor invocation and use the
981 // on-stack receiver as the result. 982 // on-stack receiver as the result.
982 __ bind(&use_receiver); 983 __ bind(&use_receiver);
983 __ lw(v0, MemOperand(sp)); 984 __ lw(v0, MemOperand(sp));
984 985
985 // Remove receiver from the stack, remove caller arguments, and 986 // Remove receiver from the stack, remove caller arguments, and
986 // return. 987 // return.
987 __ bind(&exit); 988 __ bind(&exit);
988 // v0: result 989 // v0: result
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
1067 __ mov(s2, t0); 1068 __ mov(s2, t0);
1068 __ mov(s3, t0); 1069 __ mov(s3, t0);
1069 __ mov(s4, t0); 1070 __ mov(s4, t0);
1070 __ mov(s5, t0); 1071 __ mov(s5, t0);
1071 // s6 holds the root address. Do not clobber. 1072 // s6 holds the root address. Do not clobber.
1072 // s7 is cp. Do not init. 1073 // s7 is cp. Do not init.
1073 1074
1074 // Invoke the code and pass argc as a0. 1075 // Invoke the code and pass argc as a0.
1075 __ mov(a0, a3); 1076 __ mov(a0, a3);
1076 if (is_construct) { 1077 if (is_construct) {
1077 __ Call(masm->isolate()->builtins()->JSConstructCall(), 1078 __ Call(masm->isolate()->builtins()->JSConstructCall());
1078 RelocInfo::CODE_TARGET);
1079 } else { 1079 } else {
1080 ParameterCount actual(a0); 1080 ParameterCount actual(a0);
1081 __ InvokeFunction(a1, actual, CALL_FUNCTION); 1081 __ InvokeFunction(a1, actual, CALL_FUNCTION,
1082 NullCallWrapper(), CALL_AS_METHOD);
1082 } 1083 }
1083 1084
1084 __ LeaveInternalFrame(); 1085 __ LeaveInternalFrame();
1085 1086
1086 __ Jump(ra); 1087 __ Jump(ra);
1087 } 1088 }
1088 1089
1089 1090
1090 void Builtins::Generate_JSEntryTrampoline(MacroAssembler* masm) { 1091 void Builtins::Generate_JSEntryTrampoline(MacroAssembler* masm) {
1091 Generate_JSEntryTrampolineHelper(masm, false); 1092 Generate_JSEntryTrampolineHelper(masm, false);
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1207 __ lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); 1208 __ lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset));
1208 1209
1209 // Do not transform the receiver for strict mode functions. 1210 // Do not transform the receiver for strict mode functions.
1210 __ lw(a2, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); 1211 __ lw(a2, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
1211 __ lw(a3, FieldMemOperand(a2, SharedFunctionInfo::kCompilerHintsOffset)); 1212 __ lw(a3, FieldMemOperand(a2, SharedFunctionInfo::kCompilerHintsOffset));
1212 __ And(t0, a3, Operand(1 << (SharedFunctionInfo::kStrictModeFunction + 1213 __ And(t0, a3, Operand(1 << (SharedFunctionInfo::kStrictModeFunction +
1213 kSmiTagSize))); 1214 kSmiTagSize)));
1214 __ Branch(&shift_arguments, ne, t0, Operand(zero_reg)); 1215 __ Branch(&shift_arguments, ne, t0, Operand(zero_reg));
1215 1216
1216 // Do not transform the receiver for native (Compilerhints already in a3). 1217 // Do not transform the receiver for native (Compilerhints already in a3).
1217 __ And(t0, a3, Operand(1 << (SharedFunctionInfo::kES5Native + 1218 __ And(t0, a3, Operand(1 << (SharedFunctionInfo::kNative + kSmiTagSize)));
1218 kSmiTagSize)));
1219 __ Branch(&shift_arguments, ne, t0, Operand(zero_reg)); 1219 __ Branch(&shift_arguments, ne, t0, Operand(zero_reg));
1220 1220
1221 // Compute the receiver in non-strict mode. 1221 // Compute the receiver in non-strict mode.
1222 // Load first argument in a2. a2 = -kPointerSize(sp + n_args << 2). 1222 // Load first argument in a2. a2 = -kPointerSize(sp + n_args << 2).
1223 __ sll(at, a0, kPointerSizeLog2); 1223 __ sll(at, a0, kPointerSizeLog2);
1224 __ addu(a2, sp, at); 1224 __ addu(a2, sp, at);
1225 __ lw(a2, MemOperand(a2, -kPointerSize)); 1225 __ lw(a2, MemOperand(a2, -kPointerSize));
1226 // a0: actual number of arguments 1226 // a0: actual number of arguments
1227 // a1: function 1227 // a1: function
1228 // a2: first argument 1228 // a2: first argument
1229 __ JumpIfSmi(a2, &convert_to_object, t2); 1229 __ JumpIfSmi(a2, &convert_to_object, t2);
1230 1230
1231 __ LoadRoot(a3, Heap::kUndefinedValueRootIndex); 1231 __ LoadRoot(a3, Heap::kUndefinedValueRootIndex);
1232 __ Branch(&use_global_receiver, eq, a2, Operand(a3)); 1232 __ Branch(&use_global_receiver, eq, a2, Operand(a3));
1233 __ LoadRoot(a3, Heap::kNullValueRootIndex); 1233 __ LoadRoot(a3, Heap::kNullValueRootIndex);
1234 __ Branch(&use_global_receiver, eq, a2, Operand(a3)); 1234 __ Branch(&use_global_receiver, eq, a2, Operand(a3));
1235 1235
1236 STATIC_ASSERT(LAST_JS_OBJECT_TYPE + 1 == LAST_TYPE); 1236 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE);
1237 STATIC_ASSERT(LAST_TYPE == JS_FUNCTION_TYPE);
1238 __ GetObjectType(a2, a3, a3); 1237 __ GetObjectType(a2, a3, a3);
1239 __ Branch(&shift_arguments, ge, a3, Operand(FIRST_JS_OBJECT_TYPE)); 1238 __ Branch(&shift_arguments, ge, a3, Operand(FIRST_SPEC_OBJECT_TYPE));
1240 1239
1241 __ bind(&convert_to_object); 1240 __ bind(&convert_to_object);
1242 __ EnterInternalFrame(); // In order to preserve argument count. 1241 __ EnterInternalFrame(); // In order to preserve argument count.
1243 __ sll(a0, a0, kSmiTagSize); // Smi tagged. 1242 __ sll(a0, a0, kSmiTagSize); // Smi tagged.
1244 __ push(a0); 1243 __ push(a0);
1245 1244
1246 __ push(a2); 1245 __ push(a2);
1247 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); 1246 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION);
1248 __ mov(a2, v0); 1247 __ mov(a2, v0);
1249 1248
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
1332 __ lw(a2, 1331 __ lw(a2,
1333 FieldMemOperand(a3, SharedFunctionInfo::kFormalParameterCountOffset)); 1332 FieldMemOperand(a3, SharedFunctionInfo::kFormalParameterCountOffset));
1334 __ sra(a2, a2, kSmiTagSize); 1333 __ sra(a2, a2, kSmiTagSize);
1335 __ lw(a3, FieldMemOperand(a1, JSFunction::kCodeEntryOffset)); 1334 __ lw(a3, FieldMemOperand(a1, JSFunction::kCodeEntryOffset));
1336 __ SetCallKind(t1, CALL_AS_METHOD); 1335 __ SetCallKind(t1, CALL_AS_METHOD);
1337 // Check formal and actual parameter counts. 1336 // Check formal and actual parameter counts.
1338 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), 1337 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
1339 RelocInfo::CODE_TARGET, ne, a2, Operand(a0)); 1338 RelocInfo::CODE_TARGET, ne, a2, Operand(a0));
1340 1339
1341 ParameterCount expected(0); 1340 ParameterCount expected(0);
1342 __ InvokeCode(a3, expected, expected, JUMP_FUNCTION); 1341 __ InvokeCode(a3, expected, expected, JUMP_FUNCTION,
1342 NullCallWrapper(), CALL_AS_METHOD);
1343 } 1343 }
1344 1344
1345 1345
1346 void Builtins::Generate_FunctionApply(MacroAssembler* masm) { 1346 void Builtins::Generate_FunctionApply(MacroAssembler* masm) {
1347 const int kIndexOffset = -5 * kPointerSize; 1347 const int kIndexOffset = -5 * kPointerSize;
1348 const int kLimitOffset = -4 * kPointerSize; 1348 const int kLimitOffset = -4 * kPointerSize;
1349 const int kArgsOffset = 2 * kPointerSize; 1349 const int kArgsOffset = 2 * kPointerSize;
1350 const int kRecvOffset = 3 * kPointerSize; 1350 const int kRecvOffset = 3 * kPointerSize;
1351 const int kFunctionOffset = 4 * kPointerSize; 1351 const int kFunctionOffset = 4 * kPointerSize;
1352 1352
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1394 Label call_to_object, use_global_receiver, push_receiver; 1394 Label call_to_object, use_global_receiver, push_receiver;
1395 __ lw(a0, MemOperand(fp, kRecvOffset)); 1395 __ lw(a0, MemOperand(fp, kRecvOffset));
1396 1396
1397 // Do not transform the receiver for strict mode functions. 1397 // Do not transform the receiver for strict mode functions.
1398 __ lw(a2, FieldMemOperand(a1, SharedFunctionInfo::kCompilerHintsOffset)); 1398 __ lw(a2, FieldMemOperand(a1, SharedFunctionInfo::kCompilerHintsOffset));
1399 __ And(t0, a2, Operand(1 << (SharedFunctionInfo::kStrictModeFunction + 1399 __ And(t0, a2, Operand(1 << (SharedFunctionInfo::kStrictModeFunction +
1400 kSmiTagSize))); 1400 kSmiTagSize)));
1401 __ Branch(&push_receiver, ne, t0, Operand(zero_reg)); 1401 __ Branch(&push_receiver, ne, t0, Operand(zero_reg));
1402 1402
1403 // Do not transform the receiver for native (Compilerhints already in a2). 1403 // Do not transform the receiver for native (Compilerhints already in a2).
1404 __ And(t0, a2, Operand(1 << (SharedFunctionInfo::kES5Native + 1404 __ And(t0, a2, Operand(1 << (SharedFunctionInfo::kNative + kSmiTagSize)));
1405 kSmiTagSize)));
1406 __ Branch(&push_receiver, ne, t0, Operand(zero_reg)); 1405 __ Branch(&push_receiver, ne, t0, Operand(zero_reg));
1407 1406
1408 // Compute the receiver in non-strict mode. 1407 // Compute the receiver in non-strict mode.
1409 __ And(t0, a0, Operand(kSmiTagMask)); 1408 __ And(t0, a0, Operand(kSmiTagMask));
1410 __ Branch(&call_to_object, eq, t0, Operand(zero_reg)); 1409 __ Branch(&call_to_object, eq, t0, Operand(zero_reg));
1411 __ LoadRoot(a1, Heap::kNullValueRootIndex); 1410 __ LoadRoot(a1, Heap::kNullValueRootIndex);
1412 __ Branch(&use_global_receiver, eq, a0, Operand(a1)); 1411 __ Branch(&use_global_receiver, eq, a0, Operand(a1));
1413 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); 1412 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex);
1414 __ Branch(&use_global_receiver, eq, a0, Operand(a2)); 1413 __ Branch(&use_global_receiver, eq, a0, Operand(a2));
1415 1414
1416 // Check if the receiver is already a JavaScript object. 1415 // Check if the receiver is already a JavaScript object.
1417 // a0: receiver 1416 // a0: receiver
1418 STATIC_ASSERT(LAST_JS_OBJECT_TYPE + 1 == LAST_TYPE); 1417 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE);
1419 STATIC_ASSERT(LAST_TYPE == JS_FUNCTION_TYPE);
1420 __ GetObjectType(a0, a1, a1); 1418 __ GetObjectType(a0, a1, a1);
1421 __ Branch(&push_receiver, ge, a1, Operand(FIRST_JS_OBJECT_TYPE)); 1419 __ Branch(&push_receiver, ge, a1, Operand(FIRST_SPEC_OBJECT_TYPE));
1422 1420
1423 // Convert the receiver to a regular object. 1421 // Convert the receiver to a regular object.
1424 // a0: receiver 1422 // a0: receiver
1425 __ bind(&call_to_object); 1423 __ bind(&call_to_object);
1426 __ push(a0); 1424 __ push(a0);
1427 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); 1425 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION);
1428 __ mov(a0, v0); // Put object in a0 to match other paths to push_receiver. 1426 __ mov(a0, v0); // Put object in a0 to match other paths to push_receiver.
1429 __ Branch(&push_receiver); 1427 __ Branch(&push_receiver);
1430 1428
1431 // Use the current global receiver object as the receiver. 1429 // Use the current global receiver object as the receiver.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1466 1464
1467 // Test if the copy loop has finished copying all the elements from the 1465 // Test if the copy loop has finished copying all the elements from the
1468 // arguments object. 1466 // arguments object.
1469 __ bind(&entry); 1467 __ bind(&entry);
1470 __ lw(a1, MemOperand(fp, kLimitOffset)); 1468 __ lw(a1, MemOperand(fp, kLimitOffset));
1471 __ Branch(&loop, ne, a0, Operand(a1)); 1469 __ Branch(&loop, ne, a0, Operand(a1));
1472 // Invoke the function. 1470 // Invoke the function.
1473 ParameterCount actual(a0); 1471 ParameterCount actual(a0);
1474 __ sra(a0, a0, kSmiTagSize); 1472 __ sra(a0, a0, kSmiTagSize);
1475 __ lw(a1, MemOperand(fp, kFunctionOffset)); 1473 __ lw(a1, MemOperand(fp, kFunctionOffset));
1476 __ InvokeFunction(a1, actual, CALL_FUNCTION); 1474 __ InvokeFunction(a1, actual, CALL_FUNCTION,
1475 NullCallWrapper(), CALL_AS_METHOD);
1477 1476
1478 // Tear down the internal frame and remove function, receiver and args. 1477 // Tear down the internal frame and remove function, receiver and args.
1479 __ LeaveInternalFrame(); 1478 __ LeaveInternalFrame();
1480 __ Addu(sp, sp, Operand(3 * kPointerSize)); 1479 __ Addu(sp, sp, Operand(3 * kPointerSize));
1481 __ Ret(); 1480 __ Ret();
1482 } 1481 }
1483 1482
1484 1483
1485 static void EnterArgumentsAdaptorFrame(MacroAssembler* masm) { 1484 static void EnterArgumentsAdaptorFrame(MacroAssembler* masm) {
1486 __ sll(a0, a0, kSmiTagSize); 1485 __ sll(a0, a0, kSmiTagSize);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
1566 // Calculate copy start address into a0 and copy end address is fp. 1565 // Calculate copy start address into a0 and copy end address is fp.
1567 // a0: actual number of arguments as a smi 1566 // a0: actual number of arguments as a smi
1568 // a1: function 1567 // a1: function
1569 // a2: expected number of arguments 1568 // a2: expected number of arguments
1570 // a3: code entry to call 1569 // a3: code entry to call
1571 __ sll(a0, a0, kPointerSizeLog2 - kSmiTagSize); 1570 __ sll(a0, a0, kPointerSizeLog2 - kSmiTagSize);
1572 __ Addu(a0, fp, a0); 1571 __ Addu(a0, fp, a0);
1573 // Adjust for return address and receiver. 1572 // Adjust for return address and receiver.
1574 __ Addu(a0, a0, Operand(2 * kPointerSize)); 1573 __ Addu(a0, a0, Operand(2 * kPointerSize));
1575 // Compute copy end address. Also adjust for return address. 1574 // Compute copy end address. Also adjust for return address.
1576 __ Addu(t1, fp, kPointerSize); 1575 __ Addu(t3, fp, kPointerSize);
1577 1576
1578 // Copy the arguments (including the receiver) to the new stack frame. 1577 // Copy the arguments (including the receiver) to the new stack frame.
1579 // a0: copy start address 1578 // a0: copy start address
1580 // a1: function 1579 // a1: function
1581 // a2: expected number of arguments 1580 // a2: expected number of arguments
1582 // a3: code entry to call 1581 // a3: code entry to call
1583 // t1: copy end address 1582 // t3: copy end address
1584 Label copy; 1583 Label copy;
1585 __ bind(&copy); 1584 __ bind(&copy);
1586 __ lw(t0, MemOperand(a0)); // Adjusted above for return addr and receiver. 1585 __ lw(t0, MemOperand(a0)); // Adjusted above for return addr and receiver.
1587 __ push(t0); 1586 __ push(t0);
1588 __ Subu(a0, a0, kPointerSize); 1587 __ Subu(a0, a0, kPointerSize);
1589 __ Branch(&copy, ne, a0, Operand(t1)); 1588 __ Branch(&copy, ne, a0, Operand(t3));
1590 1589
1591 // Fill the remaining expected arguments with undefined. 1590 // Fill the remaining expected arguments with undefined.
1592 // a1: function 1591 // a1: function
1593 // a2: expected number of arguments 1592 // a2: expected number of arguments
1594 // a3: code entry to call 1593 // a3: code entry to call
1595 __ LoadRoot(t0, Heap::kUndefinedValueRootIndex); 1594 __ LoadRoot(t0, Heap::kUndefinedValueRootIndex);
1596 __ sll(t2, a2, kPointerSizeLog2); 1595 __ sll(t2, a2, kPointerSizeLog2);
1597 __ Subu(a2, fp, Operand(t2)); 1596 __ Subu(a2, fp, Operand(t2));
1598 __ Addu(a2, a2, Operand(-4 * kPointerSize)); // Adjust for frame. 1597 __ Addu(a2, a2, Operand(-4 * kPointerSize)); // Adjust for frame.
1599 1598
(...skipping 19 matching lines...) Expand all
1619 __ bind(&dont_adapt_arguments); 1618 __ bind(&dont_adapt_arguments);
1620 __ Jump(a3); 1619 __ Jump(a3);
1621 } 1620 }
1622 1621
1623 1622
1624 #undef __ 1623 #undef __
1625 1624
1626 } } // namespace v8::internal 1625 } } // namespace v8::internal
1627 1626
1628 #endif // V8_TARGET_ARCH_MIPS 1627 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/assembler-mips-inl.h ('k') | src/mips/code-stubs-mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698