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

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

Issue 2302923002: [stubs] Port ToName stub to TurboFan. (Closed)
Patch Set: Fixed nits. Created 4 years, 3 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
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 2196 matching lines...) Expand 10 before | Expand all | Expand 10 after
2207 MachineRepresentation::kWord16, result, 2207 MachineRepresentation::kWord16, result,
2208 IntPtrConstant(SeqTwoByteString::kHeaderSize - kHeapObjectTag), code); 2208 IntPtrConstant(SeqTwoByteString::kHeaderSize - kHeapObjectTag), code);
2209 var_result.Bind(result); 2209 var_result.Bind(result);
2210 Goto(&if_done); 2210 Goto(&if_done);
2211 } 2211 }
2212 2212
2213 Bind(&if_done); 2213 Bind(&if_done);
2214 return var_result.value(); 2214 return var_result.value();
2215 } 2215 }
2216 2216
2217 Node* CodeStubAssembler::ToName(Node* context, Node* value) {
2218 typedef CodeStubAssembler::Label Label;
2219 typedef CodeStubAssembler::Variable Variable;
2220
2221 Label end(this);
2222 Variable var_result(this, MachineRepresentation::kTagged);
2223
2224 Label is_number(this);
2225 GotoIf(WordIsSmi(value), &is_number);
2226
2227 Label not_name(this);
2228 Node* value_instance_type = LoadInstanceType(value);
2229 STATIC_ASSERT(FIRST_NAME_TYPE == FIRST_TYPE);
2230 GotoIf(Int32GreaterThan(value_instance_type, Int32Constant(LAST_NAME_TYPE)),
2231 &not_name);
2232
2233 var_result.Bind(value);
2234 Goto(&end);
2235
2236 Bind(&is_number);
2237 {
2238 Callable callable = CodeFactory::NumberToString(isolate());
2239 var_result.Bind(CallStub(callable, context, value));
2240 Goto(&end);
2241 }
2242
2243 Bind(&not_name);
2244 {
2245 GotoIf(Word32Equal(value_instance_type, Int32Constant(HEAP_NUMBER_TYPE)),
2246 &is_number);
2247
2248 Label not_oddball(this);
2249 GotoIf(Word32NotEqual(value_instance_type, Int32Constant(ODDBALL_TYPE)),
2250 &not_oddball);
2251
2252 var_result.Bind(LoadObjectField(value, Oddball::kToStringOffset));
2253 Goto(&end);
2254
2255 Bind(&not_oddball);
2256 {
2257 var_result.Bind(CallRuntime(Runtime::kToName, context, value));
2258 Goto(&end);
2259 }
2260 }
2261
2262 Bind(&end);
2263 return var_result.value();
2264 }
2265
2217 Node* CodeStubAssembler::BitFieldDecode(Node* word32, uint32_t shift, 2266 Node* CodeStubAssembler::BitFieldDecode(Node* word32, uint32_t shift,
2218 uint32_t mask) { 2267 uint32_t mask) {
2219 return Word32Shr(Word32And(word32, Int32Constant(mask)), 2268 return Word32Shr(Word32And(word32, Int32Constant(mask)),
2220 static_cast<int>(shift)); 2269 static_cast<int>(shift));
2221 } 2270 }
2222 2271
2223 void CodeStubAssembler::SetCounter(StatsCounter* counter, int value) { 2272 void CodeStubAssembler::SetCounter(StatsCounter* counter, int value) {
2224 if (FLAG_native_code_counters && counter->Enabled()) { 2273 if (FLAG_native_code_counters && counter->Enabled()) {
2225 Node* counter_address = ExternalConstant(ExternalReference(counter)); 2274 Node* counter_address = ExternalConstant(ExternalReference(counter));
2226 StoreNoWriteBarrier(MachineRepresentation::kWord32, counter_address, 2275 StoreNoWriteBarrier(MachineRepresentation::kWord32, counter_address,
(...skipping 1983 matching lines...) Expand 10 before | Expand all | Expand 10 after
4210 Heap::kTheHoleValueRootIndex); 4259 Heap::kTheHoleValueRootIndex);
4211 4260
4212 // Store the WeakCell in the feedback vector. 4261 // Store the WeakCell in the feedback vector.
4213 StoreFixedArrayElement(feedback_vector, slot, cell, UPDATE_WRITE_BARRIER, 4262 StoreFixedArrayElement(feedback_vector, slot, cell, UPDATE_WRITE_BARRIER,
4214 CodeStubAssembler::SMI_PARAMETERS); 4263 CodeStubAssembler::SMI_PARAMETERS);
4215 return cell; 4264 return cell;
4216 } 4265 }
4217 4266
4218 } // namespace internal 4267 } // namespace internal
4219 } // namespace v8 4268 } // namespace v8
OLDNEW
« no previous file with comments | « src/code-stub-assembler.h ('k') | src/code-stubs.h » ('j') | src/interpreter/interpreter.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698