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

Side by Side Diff: src/interpreter/interpreter-intrinsics.cc

Issue 2407303002: [stubs] Renames WordIsSmi to TaggedIsSmi, introducing an appropriate bitcast of the parameter. (Closed)
Patch Set: Renamed TaggedValueIsSmi to TaggedIsSmi. Created 4 years, 2 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/interpreter/interpreter-assembler.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 #include "src/interpreter/interpreter-intrinsics.h" 5 #include "src/interpreter/interpreter-intrinsics.h"
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 return __ Int32GreaterThanOrEqual(instance_type, __ Int32Constant(type)); 118 return __ Int32GreaterThanOrEqual(instance_type, __ Int32Constant(type));
119 } 119 }
120 } 120 }
121 121
122 Node* IntrinsicsHelper::IsInstanceType(Node* input, int type) { 122 Node* IntrinsicsHelper::IsInstanceType(Node* input, int type) {
123 InterpreterAssembler::Variable return_value(assembler_, 123 InterpreterAssembler::Variable return_value(assembler_,
124 MachineRepresentation::kTagged); 124 MachineRepresentation::kTagged);
125 InterpreterAssembler::Label if_not_smi(assembler_), return_true(assembler_), 125 InterpreterAssembler::Label if_not_smi(assembler_), return_true(assembler_),
126 return_false(assembler_), end(assembler_); 126 return_false(assembler_), end(assembler_);
127 Node* arg = __ LoadRegister(input); 127 Node* arg = __ LoadRegister(input);
128 __ GotoIf(__ WordIsSmi(arg), &return_false); 128 __ GotoIf(__ TaggedIsSmi(arg), &return_false);
129 129
130 Node* condition = CompareInstanceType(arg, type, kInstanceTypeEqual); 130 Node* condition = CompareInstanceType(arg, type, kInstanceTypeEqual);
131 __ Branch(condition, &return_true, &return_false); 131 __ Branch(condition, &return_true, &return_false);
132 132
133 __ Bind(&return_true); 133 __ Bind(&return_true);
134 { 134 {
135 return_value.Bind(__ BooleanConstant(true)); 135 return_value.Bind(__ BooleanConstant(true));
136 __ Goto(&end); 136 __ Goto(&end);
137 } 137 }
138 138
139 __ Bind(&return_false); 139 __ Bind(&return_false);
140 { 140 {
141 return_value.Bind(__ BooleanConstant(false)); 141 return_value.Bind(__ BooleanConstant(false));
142 __ Goto(&end); 142 __ Goto(&end);
143 } 143 }
144 144
145 __ Bind(&end); 145 __ Bind(&end);
146 return return_value.value(); 146 return return_value.value();
147 } 147 }
148 148
149 Node* IntrinsicsHelper::IsJSReceiver(Node* input, Node* arg_count, 149 Node* IntrinsicsHelper::IsJSReceiver(Node* input, Node* arg_count,
150 Node* context) { 150 Node* context) {
151 InterpreterAssembler::Variable return_value(assembler_, 151 InterpreterAssembler::Variable return_value(assembler_,
152 MachineRepresentation::kTagged); 152 MachineRepresentation::kTagged);
153 InterpreterAssembler::Label return_true(assembler_), return_false(assembler_), 153 InterpreterAssembler::Label return_true(assembler_), return_false(assembler_),
154 end(assembler_); 154 end(assembler_);
155 155
156 Node* arg = __ LoadRegister(input); 156 Node* arg = __ LoadRegister(input);
157 __ GotoIf(__ WordIsSmi(arg), &return_false); 157 __ GotoIf(__ TaggedIsSmi(arg), &return_false);
158 158
159 STATIC_ASSERT(LAST_TYPE == LAST_JS_RECEIVER_TYPE); 159 STATIC_ASSERT(LAST_TYPE == LAST_JS_RECEIVER_TYPE);
160 Node* condition = CompareInstanceType(arg, FIRST_JS_RECEIVER_TYPE, 160 Node* condition = CompareInstanceType(arg, FIRST_JS_RECEIVER_TYPE,
161 kInstanceTypeGreaterThanOrEqual); 161 kInstanceTypeGreaterThanOrEqual);
162 __ Branch(condition, &return_true, &return_false); 162 __ Branch(condition, &return_true, &return_false);
163 163
164 __ Bind(&return_true); 164 __ Bind(&return_true);
165 { 165 {
166 return_value.Bind(__ BooleanConstant(true)); 166 return_value.Bind(__ BooleanConstant(true));
167 __ Goto(&end); 167 __ Goto(&end);
(...skipping 27 matching lines...) Expand all
195 } 195 }
196 196
197 Node* IntrinsicsHelper::IsSmi(Node* input, Node* arg_count, Node* context) { 197 Node* IntrinsicsHelper::IsSmi(Node* input, Node* arg_count, Node* context) {
198 InterpreterAssembler::Variable return_value(assembler_, 198 InterpreterAssembler::Variable return_value(assembler_,
199 MachineRepresentation::kTagged); 199 MachineRepresentation::kTagged);
200 InterpreterAssembler::Label if_smi(assembler_), if_not_smi(assembler_), 200 InterpreterAssembler::Label if_smi(assembler_), if_not_smi(assembler_),
201 end(assembler_); 201 end(assembler_);
202 202
203 Node* arg = __ LoadRegister(input); 203 Node* arg = __ LoadRegister(input);
204 204
205 __ Branch(__ WordIsSmi(arg), &if_smi, &if_not_smi); 205 __ Branch(__ TaggedIsSmi(arg), &if_smi, &if_not_smi);
206 __ Bind(&if_smi); 206 __ Bind(&if_smi);
207 { 207 {
208 return_value.Bind(__ BooleanConstant(true)); 208 return_value.Bind(__ BooleanConstant(true));
209 __ Goto(&end); 209 __ Goto(&end);
210 } 210 }
211 211
212 __ Bind(&if_not_smi); 212 __ Bind(&if_not_smi);
213 { 213 {
214 return_value.Bind(__ BooleanConstant(false)); 214 return_value.Bind(__ BooleanConstant(false));
215 __ Goto(&end); 215 __ Goto(&end);
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 Node* IntrinsicsHelper::ValueOf(Node* args_reg, Node* arg_count, 314 Node* IntrinsicsHelper::ValueOf(Node* args_reg, Node* arg_count,
315 Node* context) { 315 Node* context) {
316 InterpreterAssembler::Variable return_value(assembler_, 316 InterpreterAssembler::Variable return_value(assembler_,
317 MachineRepresentation::kTagged); 317 MachineRepresentation::kTagged);
318 InterpreterAssembler::Label done(assembler_); 318 InterpreterAssembler::Label done(assembler_);
319 319
320 Node* object = __ LoadRegister(args_reg); 320 Node* object = __ LoadRegister(args_reg);
321 return_value.Bind(object); 321 return_value.Bind(object);
322 322
323 // If the object is a smi return the object. 323 // If the object is a smi return the object.
324 __ GotoIf(__ WordIsSmi(object), &done); 324 __ GotoIf(__ TaggedIsSmi(object), &done);
325 325
326 // If the object is not a value type, return the object. 326 // If the object is not a value type, return the object.
327 Node* condition = 327 Node* condition =
328 CompareInstanceType(object, JS_VALUE_TYPE, kInstanceTypeEqual); 328 CompareInstanceType(object, JS_VALUE_TYPE, kInstanceTypeEqual);
329 __ GotoUnless(condition, &done); 329 __ GotoUnless(condition, &done);
330 330
331 // If the object is a value type, return the value field. 331 // If the object is a value type, return the value field.
332 return_value.Bind(__ LoadObjectField(object, JSValue::kValueOffset)); 332 return_value.Bind(__ LoadObjectField(object, JSValue::kValueOffset));
333 __ Goto(&done); 333 __ Goto(&done);
334 334
335 __ Bind(&done); 335 __ Bind(&done);
336 return return_value.value(); 336 return return_value.value();
337 } 337 }
338 338
339 Node* IntrinsicsHelper::ClassOf(Node* args_reg, Node* arg_count, 339 Node* IntrinsicsHelper::ClassOf(Node* args_reg, Node* arg_count,
340 Node* context) { 340 Node* context) {
341 InterpreterAssembler::Variable return_value(assembler_, 341 InterpreterAssembler::Variable return_value(assembler_,
342 MachineRepresentation::kTagged); 342 MachineRepresentation::kTagged);
343 InterpreterAssembler::Label done(assembler_), null(assembler_), 343 InterpreterAssembler::Label done(assembler_), null(assembler_),
344 function(assembler_), non_function_constructor(assembler_); 344 function(assembler_), non_function_constructor(assembler_);
345 345
346 Node* object = __ LoadRegister(args_reg); 346 Node* object = __ LoadRegister(args_reg);
347 347
348 // If the object is not a JSReceiver, we return null. 348 // If the object is not a JSReceiver, we return null.
349 __ GotoIf(__ WordIsSmi(object), &null); 349 __ GotoIf(__ TaggedIsSmi(object), &null);
350 STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE); 350 STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE);
351 Node* is_js_receiver = CompareInstanceType(object, FIRST_JS_RECEIVER_TYPE, 351 Node* is_js_receiver = CompareInstanceType(object, FIRST_JS_RECEIVER_TYPE,
352 kInstanceTypeGreaterThanOrEqual); 352 kInstanceTypeGreaterThanOrEqual);
353 __ GotoUnless(is_js_receiver, &null); 353 __ GotoUnless(is_js_receiver, &null);
354 354
355 // Return 'Function' for JSFunction and JSBoundFunction objects. 355 // Return 'Function' for JSFunction and JSBoundFunction objects.
356 Node* is_function = CompareInstanceType(object, FIRST_FUNCTION_TYPE, 356 Node* is_function = CompareInstanceType(object, FIRST_FUNCTION_TYPE,
357 kInstanceTypeGreaterThanOrEqual); 357 kInstanceTypeGreaterThanOrEqual);
358 STATIC_ASSERT(LAST_FUNCTION_TYPE == LAST_TYPE); 358 STATIC_ASSERT(LAST_FUNCTION_TYPE == LAST_TYPE);
359 __ GotoIf(is_function, &function); 359 __ GotoIf(is_function, &function);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 Node* comparison = __ Word32Equal(actual, __ Int32Constant(expected)); 401 Node* comparison = __ Word32Equal(actual, __ Int32Constant(expected));
402 __ GotoIf(comparison, &match); 402 __ GotoIf(comparison, &match);
403 __ Abort(kWrongArgumentCountForInvokeIntrinsic); 403 __ Abort(kWrongArgumentCountForInvokeIntrinsic);
404 __ Goto(&match); 404 __ Goto(&match);
405 __ Bind(&match); 405 __ Bind(&match);
406 } 406 }
407 407
408 } // namespace interpreter 408 } // namespace interpreter
409 } // namespace internal 409 } // namespace internal
410 } // namespace v8 410 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/interpreter-assembler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698