OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 | 363 |
364 | 364 |
365 // Generate code to load the length from a string object and return the length. | 365 // Generate code to load the length from a string object and return the length. |
366 // If the receiver object is not a string or a wrapped string object the | 366 // If the receiver object is not a string or a wrapped string object the |
367 // execution continues at the miss label. The register containing the | 367 // execution continues at the miss label. The register containing the |
368 // receiver is potentially clobbered. | 368 // receiver is potentially clobbered. |
369 void StubCompiler::GenerateLoadStringLength(MacroAssembler* masm, | 369 void StubCompiler::GenerateLoadStringLength(MacroAssembler* masm, |
370 Register receiver, | 370 Register receiver, |
371 Register scratch1, | 371 Register scratch1, |
372 Register scratch2, | 372 Register scratch2, |
373 Label* miss) { | 373 Label* miss, |
| 374 bool support_wrappers) { |
374 Label check_wrapper; | 375 Label check_wrapper; |
375 | 376 |
376 // Check if the object is a string leaving the instance type in the | 377 // Check if the object is a string leaving the instance type in the |
377 // scratch1 register. | 378 // scratch1 register. |
378 GenerateStringCheck(masm, receiver, scratch1, scratch2, miss, &check_wrapper); | 379 GenerateStringCheck(masm, receiver, scratch1, scratch2, miss, |
| 380 support_wrappers ? &check_wrapper : miss); |
379 | 381 |
380 // Load length directly from the string. | 382 // Load length directly from the string. |
381 __ ldr(r0, FieldMemOperand(receiver, String::kLengthOffset)); | 383 __ ldr(r0, FieldMemOperand(receiver, String::kLengthOffset)); |
382 __ Ret(); | 384 __ Ret(); |
383 | 385 |
384 // Check if the object is a JSValue wrapper. | 386 if (support_wrappers) { |
385 __ bind(&check_wrapper); | 387 // Check if the object is a JSValue wrapper. |
386 __ cmp(scratch1, Operand(JS_VALUE_TYPE)); | 388 __ bind(&check_wrapper); |
387 __ b(ne, miss); | 389 __ cmp(scratch1, Operand(JS_VALUE_TYPE)); |
| 390 __ b(ne, miss); |
388 | 391 |
389 // Unwrap the value and check if the wrapped value is a string. | 392 // Unwrap the value and check if the wrapped value is a string. |
390 __ ldr(scratch1, FieldMemOperand(receiver, JSValue::kValueOffset)); | 393 __ ldr(scratch1, FieldMemOperand(receiver, JSValue::kValueOffset)); |
391 GenerateStringCheck(masm, scratch1, scratch2, scratch2, miss, miss); | 394 GenerateStringCheck(masm, scratch1, scratch2, scratch2, miss, miss); |
392 __ ldr(r0, FieldMemOperand(scratch1, String::kLengthOffset)); | 395 __ ldr(r0, FieldMemOperand(scratch1, String::kLengthOffset)); |
393 __ Ret(); | 396 __ Ret(); |
| 397 } |
394 } | 398 } |
395 | 399 |
396 | 400 |
397 void StubCompiler::GenerateLoadFunctionPrototype(MacroAssembler* masm, | 401 void StubCompiler::GenerateLoadFunctionPrototype(MacroAssembler* masm, |
398 Register receiver, | 402 Register receiver, |
399 Register scratch1, | 403 Register scratch1, |
400 Register scratch2, | 404 Register scratch2, |
401 Label* miss_label) { | 405 Label* miss_label) { |
402 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label); | 406 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label); |
403 __ mov(r0, scratch1); | 407 __ mov(r0, scratch1); |
(...skipping 2584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2988 // -- r0 : key | 2992 // -- r0 : key |
2989 // -- r1 : receiver | 2993 // -- r1 : receiver |
2990 // ----------------------------------- | 2994 // ----------------------------------- |
2991 Label miss; | 2995 Label miss; |
2992 __ IncrementCounter(&Counters::keyed_load_string_length, 1, r2, r3); | 2996 __ IncrementCounter(&Counters::keyed_load_string_length, 1, r2, r3); |
2993 | 2997 |
2994 // Check the key is the cached one. | 2998 // Check the key is the cached one. |
2995 __ cmp(r0, Operand(Handle<String>(name))); | 2999 __ cmp(r0, Operand(Handle<String>(name))); |
2996 __ b(ne, &miss); | 3000 __ b(ne, &miss); |
2997 | 3001 |
2998 GenerateLoadStringLength(masm(), r1, r2, r3, &miss); | 3002 GenerateLoadStringLength(masm(), r1, r2, r3, &miss, true); |
2999 __ bind(&miss); | 3003 __ bind(&miss); |
3000 __ DecrementCounter(&Counters::keyed_load_string_length, 1, r2, r3); | 3004 __ DecrementCounter(&Counters::keyed_load_string_length, 1, r2, r3); |
3001 | 3005 |
3002 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 3006 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
3003 | 3007 |
3004 return GetCode(CALLBACKS, name); | 3008 return GetCode(CALLBACKS, name); |
3005 } | 3009 } |
3006 | 3010 |
3007 | 3011 |
3008 MaybeObject* KeyedLoadStubCompiler::CompileLoadFunctionPrototype(String* name) { | 3012 MaybeObject* KeyedLoadStubCompiler::CompileLoadFunctionPrototype(String* name) { |
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3924 | 3928 |
3925 return GetCode(flags); | 3929 return GetCode(flags); |
3926 } | 3930 } |
3927 | 3931 |
3928 | 3932 |
3929 #undef __ | 3933 #undef __ |
3930 | 3934 |
3931 } } // namespace v8::internal | 3935 } } // namespace v8::internal |
3932 | 3936 |
3933 #endif // V8_TARGET_ARCH_ARM | 3937 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |