OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/builtins/builtins.h" | 5 #include "src/builtins/builtins.h" |
6 #include "src/builtins/builtins-utils.h" | 6 #include "src/builtins/builtins-utils.h" |
7 | 7 |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 assembler.Return(result); | 74 assembler.Return(result); |
75 } | 75 } |
76 } | 76 } |
77 } | 77 } |
78 | 78 |
79 assembler.Bind(&if_xisnotsmi); | 79 assembler.Bind(&if_xisnotsmi); |
80 { | 80 { |
81 // Check if {x} is a HeapNumber. | 81 // Check if {x} is a HeapNumber. |
82 Label if_xisheapnumber(&assembler), | 82 Label if_xisheapnumber(&assembler), |
83 if_xisnotheapnumber(&assembler, Label::kDeferred); | 83 if_xisnotheapnumber(&assembler, Label::kDeferred); |
84 assembler.Branch(assembler.WordEqual(assembler.LoadMap(x), | 84 assembler.Branch(assembler.IsHeapNumberMap(assembler.LoadMap(x)), |
85 assembler.HeapNumberMapConstant()), | |
86 &if_xisheapnumber, &if_xisnotheapnumber); | 85 &if_xisheapnumber, &if_xisnotheapnumber); |
87 | 86 |
88 assembler.Bind(&if_xisheapnumber); | 87 assembler.Bind(&if_xisheapnumber); |
89 { | 88 { |
90 Node* x_value = assembler.LoadHeapNumberValue(x); | 89 Node* x_value = assembler.LoadHeapNumberValue(x); |
91 Node* value = assembler.Float64Abs(x_value); | 90 Node* value = assembler.Float64Abs(x_value); |
92 Node* result = assembler.AllocateHeapNumberWithValue(value); | 91 Node* result = assembler.AllocateHeapNumberWithValue(value); |
93 assembler.Return(result); | 92 assembler.Return(result); |
94 } | 93 } |
95 | 94 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 { | 132 { |
134 // Nothing to do when {x} is a Smi. | 133 // Nothing to do when {x} is a Smi. |
135 assembler->Return(x); | 134 assembler->Return(x); |
136 } | 135 } |
137 | 136 |
138 assembler->Bind(&if_xisnotsmi); | 137 assembler->Bind(&if_xisnotsmi); |
139 { | 138 { |
140 // Check if {x} is a HeapNumber. | 139 // Check if {x} is a HeapNumber. |
141 Label if_xisheapnumber(assembler), | 140 Label if_xisheapnumber(assembler), |
142 if_xisnotheapnumber(assembler, Label::kDeferred); | 141 if_xisnotheapnumber(assembler, Label::kDeferred); |
143 assembler->Branch( | 142 assembler->Branch(assembler->IsHeapNumberMap(assembler->LoadMap(x)), |
144 assembler->WordEqual(assembler->LoadMap(x), | 143 &if_xisheapnumber, &if_xisnotheapnumber); |
145 assembler->HeapNumberMapConstant()), | |
146 &if_xisheapnumber, &if_xisnotheapnumber); | |
147 | 144 |
148 assembler->Bind(&if_xisheapnumber); | 145 assembler->Bind(&if_xisheapnumber); |
149 { | 146 { |
150 Node* x_value = assembler->LoadHeapNumberValue(x); | 147 Node* x_value = assembler->LoadHeapNumberValue(x); |
151 Node* value = (assembler->*float64op)(x_value); | 148 Node* value = (assembler->*float64op)(x_value); |
152 Node* result = assembler->ChangeFloat64ToTagged(value); | 149 Node* result = assembler->ChangeFloat64ToTagged(value); |
153 assembler->Return(result); | 150 assembler->Return(result); |
154 } | 151 } |
155 | 152 |
156 assembler->Bind(&if_xisnotheapnumber); | 153 assembler->Bind(&if_xisnotheapnumber); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 { | 271 { |
275 var_clz32_x.Bind(assembler.SmiToWord32(x)); | 272 var_clz32_x.Bind(assembler.SmiToWord32(x)); |
276 assembler.Goto(&do_clz32); | 273 assembler.Goto(&do_clz32); |
277 } | 274 } |
278 | 275 |
279 assembler.Bind(&if_xisnotsmi); | 276 assembler.Bind(&if_xisnotsmi); |
280 { | 277 { |
281 // Check if {x} is a HeapNumber. | 278 // Check if {x} is a HeapNumber. |
282 Label if_xisheapnumber(&assembler), | 279 Label if_xisheapnumber(&assembler), |
283 if_xisnotheapnumber(&assembler, Label::kDeferred); | 280 if_xisnotheapnumber(&assembler, Label::kDeferred); |
284 assembler.Branch(assembler.WordEqual(assembler.LoadMap(x), | 281 assembler.Branch(assembler.IsHeapNumberMap(assembler.LoadMap(x)), |
285 assembler.HeapNumberMapConstant()), | |
286 &if_xisheapnumber, &if_xisnotheapnumber); | 282 &if_xisheapnumber, &if_xisnotheapnumber); |
287 | 283 |
288 assembler.Bind(&if_xisheapnumber); | 284 assembler.Bind(&if_xisheapnumber); |
289 { | 285 { |
290 var_clz32_x.Bind(assembler.TruncateHeapNumberValueToWord32(x)); | 286 var_clz32_x.Bind(assembler.TruncateHeapNumberValueToWord32(x)); |
291 assembler.Goto(&do_clz32); | 287 assembler.Goto(&do_clz32); |
292 } | 288 } |
293 | 289 |
294 assembler.Bind(&if_xisnotheapnumber); | 290 assembler.Bind(&if_xisnotheapnumber); |
295 { | 291 { |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 void Builtins::Generate_MathMax(MacroAssembler* masm) { | 570 void Builtins::Generate_MathMax(MacroAssembler* masm) { |
575 Generate_MathMaxMin(masm, MathMaxMinKind::kMax); | 571 Generate_MathMaxMin(masm, MathMaxMinKind::kMax); |
576 } | 572 } |
577 | 573 |
578 void Builtins::Generate_MathMin(MacroAssembler* masm) { | 574 void Builtins::Generate_MathMin(MacroAssembler* masm) { |
579 Generate_MathMaxMin(masm, MathMaxMinKind::kMin); | 575 Generate_MathMaxMin(masm, MathMaxMinKind::kMin); |
580 } | 576 } |
581 | 577 |
582 } // namespace internal | 578 } // namespace internal |
583 } // namespace v8 | 579 } // namespace v8 |
OLD | NEW |