OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 | 373 |
374 | 374 |
375 // Generate code to load the length from a string object and return the length. | 375 // Generate code to load the length from a string object and return the length. |
376 // If the receiver object is not a string or a wrapped string object the | 376 // If the receiver object is not a string or a wrapped string object the |
377 // execution continues at the miss label. The register containing the | 377 // execution continues at the miss label. The register containing the |
378 // receiver is potentially clobbered. | 378 // receiver is potentially clobbered. |
379 void StubCompiler::GenerateLoadStringLength(MacroAssembler* masm, | 379 void StubCompiler::GenerateLoadStringLength(MacroAssembler* masm, |
380 Register receiver, | 380 Register receiver, |
381 Register scratch1, | 381 Register scratch1, |
382 Register scratch2, | 382 Register scratch2, |
383 Label* miss) { | 383 Label* miss, |
| 384 bool support_wrappers) { |
384 Label check_wrapper; | 385 Label check_wrapper; |
385 | 386 |
386 // Check if the object is a string leaving the instance type in the | 387 // Check if the object is a string leaving the instance type in the |
387 // scratch1 register. | 388 // scratch1 register. |
388 GenerateStringCheck(masm, receiver, scratch1, scratch2, miss, &check_wrapper); | 389 GenerateStringCheck(masm, receiver, scratch1, scratch2, miss, |
| 390 support_wrappers ? &check_wrapper : miss); |
389 | 391 |
390 // Load length directly from the string. | 392 // Load length directly from the string. |
391 __ ldr(r0, FieldMemOperand(receiver, String::kLengthOffset)); | 393 __ ldr(r0, FieldMemOperand(receiver, String::kLengthOffset)); |
392 __ Ret(); | 394 __ Ret(); |
393 | 395 |
394 // Check if the object is a JSValue wrapper. | 396 if (support_wrappers) { |
395 __ bind(&check_wrapper); | 397 // Check if the object is a JSValue wrapper. |
396 __ cmp(scratch1, Operand(JS_VALUE_TYPE)); | 398 __ bind(&check_wrapper); |
397 __ b(ne, miss); | 399 __ cmp(scratch1, Operand(JS_VALUE_TYPE)); |
| 400 __ b(ne, miss); |
398 | 401 |
399 // Unwrap the value and check if the wrapped value is a string. | 402 // Unwrap the value and check if the wrapped value is a string. |
400 __ ldr(scratch1, FieldMemOperand(receiver, JSValue::kValueOffset)); | 403 __ ldr(scratch1, FieldMemOperand(receiver, JSValue::kValueOffset)); |
401 GenerateStringCheck(masm, scratch1, scratch2, scratch2, miss, miss); | 404 GenerateStringCheck(masm, scratch1, scratch2, scratch2, miss, miss); |
402 __ ldr(r0, FieldMemOperand(scratch1, String::kLengthOffset)); | 405 __ ldr(r0, FieldMemOperand(scratch1, String::kLengthOffset)); |
403 __ Ret(); | 406 __ Ret(); |
| 407 } |
404 } | 408 } |
405 | 409 |
406 | 410 |
407 void StubCompiler::GenerateLoadFunctionPrototype(MacroAssembler* masm, | 411 void StubCompiler::GenerateLoadFunctionPrototype(MacroAssembler* masm, |
408 Register receiver, | 412 Register receiver, |
409 Register scratch1, | 413 Register scratch1, |
410 Register scratch2, | 414 Register scratch2, |
411 Label* miss_label) { | 415 Label* miss_label) { |
412 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label); | 416 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label); |
413 __ mov(r0, scratch1); | 417 __ mov(r0, scratch1); |
(...skipping 2757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3171 // ----------------------------------- | 3175 // ----------------------------------- |
3172 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); | 3176 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); |
3173 } | 3177 } |
3174 | 3178 |
3175 | 3179 |
3176 #undef __ | 3180 #undef __ |
3177 | 3181 |
3178 } } // namespace v8::internal | 3182 } } // namespace v8::internal |
3179 | 3183 |
3180 #endif // V8_TARGET_ARCH_ARM | 3184 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |