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/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 2318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2329 // Check if the {string} is an ExternalString. | 2329 // Check if the {string} is an ExternalString. |
2330 Label if_stringisexternal(this), if_stringisnotexternal(this); | 2330 Label if_stringisexternal(this), if_stringisnotexternal(this); |
2331 Branch(Word32Equal(Word32And(string_instance_type, | 2331 Branch(Word32Equal(Word32And(string_instance_type, |
2332 Int32Constant(kStringRepresentationMask)), | 2332 Int32Constant(kStringRepresentationMask)), |
2333 Int32Constant(kExternalStringTag)), | 2333 Int32Constant(kExternalStringTag)), |
2334 &if_stringisexternal, &if_stringisnotexternal); | 2334 &if_stringisexternal, &if_stringisnotexternal); |
2335 | 2335 |
2336 Bind(&if_stringisexternal); | 2336 Bind(&if_stringisexternal); |
2337 { | 2337 { |
2338 // Check if the {string} is a short external string. | 2338 // Check if the {string} is a short external string. |
2339 Label if_stringisshort(this), | 2339 Label if_stringisnotshort(this), |
2340 if_stringisnotshort(this, Label::kDeferred); | 2340 if_stringisshort(this, Label::kDeferred); |
2341 Branch(Word32Equal(Word32And(string_instance_type, | 2341 Branch(Word32Equal(Word32And(string_instance_type, |
2342 Int32Constant(kShortExternalStringMask)), | 2342 Int32Constant(kShortExternalStringMask)), |
2343 Int32Constant(0)), | 2343 Int32Constant(0)), |
2344 &if_stringisshort, &if_stringisnotshort); | 2344 &if_stringisnotshort, &if_stringisshort); |
2345 | 2345 |
2346 Bind(&if_stringisshort); | 2346 Bind(&if_stringisnotshort); |
2347 { | 2347 { |
2348 // Load the actual resource data from the {string}. | 2348 // Load the actual resource data from the {string}. |
2349 Node* string_resource_data = | 2349 Node* string_resource_data = |
2350 LoadObjectField(string, ExternalString::kResourceDataOffset, | 2350 LoadObjectField(string, ExternalString::kResourceDataOffset, |
2351 MachineType::Pointer()); | 2351 MachineType::Pointer()); |
2352 | 2352 |
2353 // Check if the {string} is a TwoByteExternalString or a | 2353 // Check if the {string} is a TwoByteExternalString or a |
2354 // OneByteExternalString. | 2354 // OneByteExternalString. |
2355 Label if_stringistwobyte(this), if_stringisonebyte(this); | 2355 Label if_stringistwobyte(this), if_stringisonebyte(this); |
2356 Branch(Word32Equal(Word32And(string_instance_type, | 2356 Branch(Word32Equal(Word32And(string_instance_type, |
2357 Int32Constant(kStringEncodingMask)), | 2357 Int32Constant(kStringEncodingMask)), |
2358 Int32Constant(kTwoByteStringTag)), | 2358 Int32Constant(kTwoByteStringTag)), |
2359 &if_stringistwobyte, &if_stringisonebyte); | 2359 &if_stringistwobyte, &if_stringisonebyte); |
2360 | 2360 |
2361 Bind(&if_stringisonebyte); | 2361 Bind(&if_stringisonebyte); |
2362 { | 2362 { |
2363 var_result.Bind( | 2363 var_result.Bind( |
2364 Load(MachineType::Uint8(), string_resource_data, index)); | 2364 Load(MachineType::Uint8(), string_resource_data, index)); |
2365 Goto(&done_loop); | 2365 Goto(&done_loop); |
2366 } | 2366 } |
2367 | 2367 |
2368 Bind(&if_stringistwobyte); | 2368 Bind(&if_stringistwobyte); |
2369 { | 2369 { |
2370 var_result.Bind(Load(MachineType::Uint16(), string_resource_data, | 2370 var_result.Bind(Load(MachineType::Uint16(), string_resource_data, |
2371 WordShl(index, IntPtrConstant(1)))); | 2371 WordShl(index, IntPtrConstant(1)))); |
2372 Goto(&done_loop); | 2372 Goto(&done_loop); |
2373 } | 2373 } |
2374 } | 2374 } |
2375 | 2375 |
2376 Bind(&if_stringisnotshort); | 2376 Bind(&if_stringisshort); |
2377 { | 2377 { |
2378 // The {string} might be compressed, call the runtime. | 2378 // The {string} might be compressed, call the runtime. |
2379 var_result.Bind(SmiToWord32( | 2379 var_result.Bind(SmiToWord32( |
2380 CallRuntime(Runtime::kExternalStringGetChar, | 2380 CallRuntime(Runtime::kExternalStringGetChar, |
2381 NoContextConstant(), string, SmiTag(index)))); | 2381 NoContextConstant(), string, SmiTag(index)))); |
2382 Goto(&done_loop); | 2382 Goto(&done_loop); |
2383 } | 2383 } |
2384 } | 2384 } |
2385 | 2385 |
2386 Bind(&if_stringisnotexternal); | 2386 Bind(&if_stringisnotexternal); |
(...skipping 3307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5694 Heap::kTheHoleValueRootIndex); | 5694 Heap::kTheHoleValueRootIndex); |
5695 | 5695 |
5696 // Store the WeakCell in the feedback vector. | 5696 // Store the WeakCell in the feedback vector. |
5697 StoreFixedArrayElement(feedback_vector, slot, cell, UPDATE_WRITE_BARRIER, | 5697 StoreFixedArrayElement(feedback_vector, slot, cell, UPDATE_WRITE_BARRIER, |
5698 CodeStubAssembler::SMI_PARAMETERS); | 5698 CodeStubAssembler::SMI_PARAMETERS); |
5699 return cell; | 5699 return cell; |
5700 } | 5700 } |
5701 | 5701 |
5702 } // namespace internal | 5702 } // namespace internal |
5703 } // namespace v8 | 5703 } // namespace v8 |
OLD | NEW |