Chromium Code Reviews

Side by Side Diff: src/code-stub-assembler.cc

Issue 2302923002: [stubs] Port ToName stub to TurboFan. (Closed)
Patch Set: Create ToName helper and inline Interpreter::DoToName Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« no previous file with comments | « src/code-stub-assembler.h ('k') | src/code-stubs.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 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/code-stub-assembler.h" 5 #include "src/code-stub-assembler.h"
6 #include "src/code-factory.h" 6 #include "src/code-factory.h"
7 #include "src/frames-inl.h" 7 #include "src/frames-inl.h"
8 #include "src/frames.h" 8 #include "src/frames.h"
9 #include "src/ic/handler-configuration.h" 9 #include "src/ic/handler-configuration.h"
10 #include "src/ic/stub-cache.h" 10 #include "src/ic/stub-cache.h"
(...skipping 2198 matching lines...)
2209 MachineRepresentation::kWord16, result, 2209 MachineRepresentation::kWord16, result,
2210 IntPtrConstant(SeqTwoByteString::kHeaderSize - kHeapObjectTag), code); 2210 IntPtrConstant(SeqTwoByteString::kHeaderSize - kHeapObjectTag), code);
2211 var_result.Bind(result); 2211 var_result.Bind(result);
2212 Goto(&if_done); 2212 Goto(&if_done);
2213 } 2213 }
2214 2214
2215 Bind(&if_done); 2215 Bind(&if_done);
2216 return var_result.value(); 2216 return var_result.value();
2217 } 2217 }
2218 2218
2219 Node* CodeStubAssembler::ToName(Node* context, Node* value) {
2220 typedef CodeStubAssembler::Label Label;
2221 typedef CodeStubAssembler::Variable Variable;
2222
2223 Label end(this);
2224 Variable var_result(this, MachineRepresentation::kTagged);
2225
2226 Label is_number(this, Label::kDeferred);
Igor Sheludko 2016/09/06 08:23:04 I would suggest not to use deferred labels when re
2227 GotoIf(WordIsSmi(value), &is_number);
2228
2229 Label not_name(this, Label::kDeferred);
Igor Sheludko 2016/09/06 08:23:04 Same here.
2230 Node* value_instance_type = LoadInstanceType(value);
Igor Sheludko 2016/09/06 08:23:04 Please add STATIC_ASSERT(FIRST_NAME_TYPE == FIRS
2231 GotoIf(Int32GreaterThan(value_instance_type, Int32Constant(LAST_NAME_TYPE)),
2232 &not_name);
2233
2234 var_result.Bind(value);
2235 Goto(&end);
2236
2237 Bind(&is_number);
2238 {
2239 Callable callable = CodeFactory::NumberToString(isolate());
2240 var_result.Bind(CallStub(callable, context, value));
2241 Goto(&end);
2242 }
2243
2244 Bind(&not_name);
2245 {
2246 GotoIf(Word32Equal(value_instance_type, Int32Constant(HEAP_NUMBER_TYPE)),
2247 &is_number);
2248
2249 Label not_oddball(this, Label::kDeferred);
Igor Sheludko 2016/09/06 08:23:04 Same here.
2250 GotoIf(Word32NotEqual(value_instance_type, Int32Constant(ODDBALL_TYPE)),
2251 &not_oddball);
2252
2253 var_result.Bind(LoadObjectField(value, Oddball::kToStringOffset));
2254 Goto(&end);
2255
2256 Bind(&not_oddball);
2257 {
2258 var_result.Bind(CallRuntime(Runtime::kToName, context, value));
2259 Goto(&end);
2260 }
2261 }
2262
2263 Bind(&end);
2264 return var_result.value();
2265 }
2266
2219 Node* CodeStubAssembler::BitFieldDecode(Node* word32, uint32_t shift, 2267 Node* CodeStubAssembler::BitFieldDecode(Node* word32, uint32_t shift,
2220 uint32_t mask) { 2268 uint32_t mask) {
2221 return Word32Shr(Word32And(word32, Int32Constant(mask)), 2269 return Word32Shr(Word32And(word32, Int32Constant(mask)),
2222 static_cast<int>(shift)); 2270 static_cast<int>(shift));
2223 } 2271 }
2224 2272
2225 void CodeStubAssembler::SetCounter(StatsCounter* counter, int value) { 2273 void CodeStubAssembler::SetCounter(StatsCounter* counter, int value) {
2226 if (FLAG_native_code_counters && counter->Enabled()) { 2274 if (FLAG_native_code_counters && counter->Enabled()) {
2227 Node* counter_address = ExternalConstant(ExternalReference(counter)); 2275 Node* counter_address = ExternalConstant(ExternalReference(counter));
2228 StoreNoWriteBarrier(MachineRepresentation::kWord32, counter_address, 2276 StoreNoWriteBarrier(MachineRepresentation::kWord32, counter_address,
(...skipping 1983 matching lines...)
4212 Heap::kTheHoleValueRootIndex); 4260 Heap::kTheHoleValueRootIndex);
4213 4261
4214 // Store the WeakCell in the feedback vector. 4262 // Store the WeakCell in the feedback vector.
4215 StoreFixedArrayElement(feedback_vector, slot, cell, UPDATE_WRITE_BARRIER, 4263 StoreFixedArrayElement(feedback_vector, slot, cell, UPDATE_WRITE_BARRIER,
4216 CodeStubAssembler::SMI_PARAMETERS); 4264 CodeStubAssembler::SMI_PARAMETERS);
4217 return cell; 4265 return cell;
4218 } 4266 }
4219 4267
4220 } // namespace internal 4268 } // namespace internal
4221 } // namespace v8 4269 } // namespace v8
OLDNEW
« no previous file with comments | « src/code-stub-assembler.h ('k') | src/code-stubs.h » ('j') | no next file with comments »

Powered by Google App Engine