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

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

Issue 170403003: templatize operand constructors (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 10 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/a64/assembler-a64-inl.h ('k') | src/a64/code-stubs-a64.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 // 2. Get the function to call (passed as receiver) from the stack, check 1020 // 2. Get the function to call (passed as receiver) from the stack, check
1021 // if it is a function. 1021 // if it is a function.
1022 Label slow, non_function; 1022 Label slow, non_function;
1023 __ Peek(function, Operand(argc, LSL, kXRegSizeInBytesLog2)); 1023 __ Peek(function, Operand(argc, LSL, kXRegSizeInBytesLog2));
1024 __ JumpIfSmi(function, &non_function); 1024 __ JumpIfSmi(function, &non_function);
1025 __ JumpIfNotObjectType(function, scratch1, receiver_type, 1025 __ JumpIfNotObjectType(function, scratch1, receiver_type,
1026 JS_FUNCTION_TYPE, &slow); 1026 JS_FUNCTION_TYPE, &slow);
1027 1027
1028 // 3a. Patch the first argument if necessary when calling a function. 1028 // 3a. Patch the first argument if necessary when calling a function.
1029 Label shift_arguments; 1029 Label shift_arguments;
1030 __ Mov(call_type, call_type_JS_func); 1030 __ Mov(call_type, static_cast<int>(call_type_JS_func));
1031 { Label convert_to_object, use_global_receiver, patch_receiver; 1031 { Label convert_to_object, use_global_receiver, patch_receiver;
1032 // Change context eagerly in case we need the global receiver. 1032 // Change context eagerly in case we need the global receiver.
1033 __ Ldr(cp, FieldMemOperand(function, JSFunction::kContextOffset)); 1033 __ Ldr(cp, FieldMemOperand(function, JSFunction::kContextOffset));
1034 1034
1035 // Do not transform the receiver for strict mode functions. 1035 // Do not transform the receiver for strict mode functions.
1036 // Also do not transform the receiver for native (Compilerhints already in 1036 // Also do not transform the receiver for native (Compilerhints already in
1037 // x3). 1037 // x3).
1038 __ Ldr(scratch1, 1038 __ Ldr(scratch1,
1039 FieldMemOperand(function, JSFunction::kSharedFunctionInfoOffset)); 1039 FieldMemOperand(function, JSFunction::kSharedFunctionInfoOffset));
1040 __ Ldr(scratch2.W(), 1040 __ Ldr(scratch2.W(),
(...skipping 30 matching lines...) Expand all
1071 __ Mov(receiver, x0); 1071 __ Mov(receiver, x0);
1072 1072
1073 __ Pop(argc); 1073 __ Pop(argc);
1074 __ SmiUntag(argc); 1074 __ SmiUntag(argc);
1075 1075
1076 // Exit the internal frame. 1076 // Exit the internal frame.
1077 } 1077 }
1078 1078
1079 // Restore the function and flag in the registers. 1079 // Restore the function and flag in the registers.
1080 __ Peek(function, Operand(argc, LSL, kXRegSizeInBytesLog2)); 1080 __ Peek(function, Operand(argc, LSL, kXRegSizeInBytesLog2));
1081 __ Mov(call_type, call_type_JS_func); 1081 __ Mov(call_type, static_cast<int>(call_type_JS_func));
1082 __ B(&patch_receiver); 1082 __ B(&patch_receiver);
1083 1083
1084 __ Bind(&use_global_receiver); 1084 __ Bind(&use_global_receiver);
1085 __ Ldr(receiver, GlobalObjectMemOperand()); 1085 __ Ldr(receiver, GlobalObjectMemOperand());
1086 __ Ldr(receiver, 1086 __ Ldr(receiver,
1087 FieldMemOperand(receiver, GlobalObject::kGlobalReceiverOffset)); 1087 FieldMemOperand(receiver, GlobalObject::kGlobalReceiverOffset));
1088 1088
1089 1089
1090 __ Bind(&patch_receiver); 1090 __ Bind(&patch_receiver);
1091 __ Sub(scratch1, argc, 1); 1091 __ Sub(scratch1, argc, 1);
1092 __ Poke(receiver, Operand(scratch1, LSL, kXRegSizeInBytesLog2)); 1092 __ Poke(receiver, Operand(scratch1, LSL, kXRegSizeInBytesLog2));
1093 1093
1094 __ B(&shift_arguments); 1094 __ B(&shift_arguments);
1095 } 1095 }
1096 1096
1097 // 3b. Check for function proxy. 1097 // 3b. Check for function proxy.
1098 __ Bind(&slow); 1098 __ Bind(&slow);
1099 __ Mov(call_type, call_type_func_proxy); 1099 __ Mov(call_type, static_cast<int>(call_type_func_proxy));
1100 __ Cmp(receiver_type, JS_FUNCTION_PROXY_TYPE); 1100 __ Cmp(receiver_type, JS_FUNCTION_PROXY_TYPE);
1101 __ B(eq, &shift_arguments); 1101 __ B(eq, &shift_arguments);
1102 __ Bind(&non_function); 1102 __ Bind(&non_function);
1103 __ Mov(call_type, call_type_non_func); 1103 __ Mov(call_type, static_cast<int>(call_type_non_func));
1104 1104
1105 // 3c. Patch the first argument when calling a non-function. The 1105 // 3c. Patch the first argument when calling a non-function. The
1106 // CALL_NON_FUNCTION builtin expects the non-function callee as 1106 // CALL_NON_FUNCTION builtin expects the non-function callee as
1107 // receiver, so overwrite the first argument which will ultimately 1107 // receiver, so overwrite the first argument which will ultimately
1108 // become the receiver. 1108 // become the receiver.
1109 // call type (0: JS function, 1: function proxy, 2: non-function) 1109 // call type (0: JS function, 1: function proxy, 2: non-function)
1110 __ Sub(scratch1, argc, 1); 1110 __ Sub(scratch1, argc, 1);
1111 __ Poke(function, Operand(scratch1, LSL, kXRegSizeInBytesLog2)); 1111 __ Poke(function, Operand(scratch1, LSL, kXRegSizeInBytesLog2));
1112 1112
1113 // 4. Shift arguments and return address one slot down on the stack 1113 // 4. Shift arguments and return address one slot down on the stack
(...skipping 17 matching lines...) Expand all
1131 __ Drop(1); 1131 __ Drop(1);
1132 } 1132 }
1133 1133
1134 // 5a. Call non-function via tail call to CALL_NON_FUNCTION builtin, 1134 // 5a. Call non-function via tail call to CALL_NON_FUNCTION builtin,
1135 // or a function proxy via CALL_FUNCTION_PROXY. 1135 // or a function proxy via CALL_FUNCTION_PROXY.
1136 // call type (0: JS function, 1: function proxy, 2: non-function) 1136 // call type (0: JS function, 1: function proxy, 2: non-function)
1137 { Label js_function, non_proxy; 1137 { Label js_function, non_proxy;
1138 __ Cbz(call_type, &js_function); 1138 __ Cbz(call_type, &js_function);
1139 // Expected number of arguments is 0 for CALL_NON_FUNCTION. 1139 // Expected number of arguments is 0 for CALL_NON_FUNCTION.
1140 __ Mov(x2, 0); 1140 __ Mov(x2, 0);
1141 __ Cmp(call_type, call_type_func_proxy); 1141 __ Cmp(call_type, static_cast<int>(call_type_func_proxy));
1142 __ B(ne, &non_proxy); 1142 __ B(ne, &non_proxy);
1143 1143
1144 __ Push(function); // Re-add proxy object as additional argument. 1144 __ Push(function); // Re-add proxy object as additional argument.
1145 __ Add(argc, argc, 1); 1145 __ Add(argc, argc, 1);
1146 __ GetBuiltinFunction(function, Builtins::CALL_FUNCTION_PROXY); 1146 __ GetBuiltinFunction(function, Builtins::CALL_FUNCTION_PROXY);
1147 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), 1147 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
1148 RelocInfo::CODE_TARGET); 1148 RelocInfo::CODE_TARGET);
1149 1149
1150 __ Bind(&non_proxy); 1150 __ Bind(&non_proxy);
1151 __ GetBuiltinFunction(function, Builtins::CALL_NON_FUNCTION); 1151 __ GetBuiltinFunction(function, Builtins::CALL_NON_FUNCTION);
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
1470 __ Bind(&dont_adapt_arguments); 1470 __ Bind(&dont_adapt_arguments);
1471 __ Jump(x3); 1471 __ Jump(x3);
1472 } 1472 }
1473 1473
1474 1474
1475 #undef __ 1475 #undef __
1476 1476
1477 } } // namespace v8::internal 1477 } } // namespace v8::internal
1478 1478
1479 #endif // V8_TARGET_ARCH_ARM 1479 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/a64/assembler-a64-inl.h ('k') | src/a64/code-stubs-a64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698