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 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 | 367 |
368 | 368 |
369 // Generate code to load the length from a string object and return the length. | 369 // Generate code to load the length from a string object and return the length. |
370 // If the receiver object is not a string or a wrapped string object the | 370 // If the receiver object is not a string or a wrapped string object the |
371 // execution continues at the miss label. The register containing the | 371 // execution continues at the miss label. The register containing the |
372 // receiver is potentially clobbered. | 372 // receiver is potentially clobbered. |
373 void StubCompiler::GenerateLoadStringLength(MacroAssembler* masm, | 373 void StubCompiler::GenerateLoadStringLength(MacroAssembler* masm, |
374 Register receiver, | 374 Register receiver, |
375 Register scratch1, | 375 Register scratch1, |
376 Register scratch2, | 376 Register scratch2, |
377 Label* miss, | 377 Label* miss) { |
378 bool support_wrappers) { | |
379 Label check_wrapper; | 378 Label check_wrapper; |
380 | 379 |
381 // Check if the object is a string leaving the instance type in the | 380 // Check if the object is a string leaving the instance type in the |
382 // scratch1 register. | 381 // scratch1 register. |
383 GenerateStringCheck(masm, receiver, scratch1, scratch2, miss, | 382 GenerateStringCheck(masm, receiver, scratch1, scratch2, miss, &check_wrapper); |
384 support_wrappers ? &check_wrapper : miss); | |
385 | 383 |
386 // Load length directly from the string. | 384 // Load length directly from the string. |
387 __ Ret(USE_DELAY_SLOT); | 385 __ Ret(USE_DELAY_SLOT); |
388 __ lw(v0, FieldMemOperand(receiver, String::kLengthOffset)); | 386 __ lw(v0, FieldMemOperand(receiver, String::kLengthOffset)); |
389 | 387 |
390 if (support_wrappers) { | 388 // Check if the object is a JSValue wrapper. |
391 // Check if the object is a JSValue wrapper. | 389 __ bind(&check_wrapper); |
392 __ bind(&check_wrapper); | 390 __ Branch(miss, ne, scratch1, Operand(JS_VALUE_TYPE)); |
393 __ Branch(miss, ne, scratch1, Operand(JS_VALUE_TYPE)); | |
394 | 391 |
395 // 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. |
396 __ lw(scratch1, FieldMemOperand(receiver, JSValue::kValueOffset)); | 393 __ lw(scratch1, FieldMemOperand(receiver, JSValue::kValueOffset)); |
397 GenerateStringCheck(masm, scratch1, scratch2, scratch2, miss, miss); | 394 GenerateStringCheck(masm, scratch1, scratch2, scratch2, miss, miss); |
398 __ Ret(USE_DELAY_SLOT); | 395 __ Ret(USE_DELAY_SLOT); |
399 __ lw(v0, FieldMemOperand(scratch1, String::kLengthOffset)); | 396 __ lw(v0, FieldMemOperand(scratch1, String::kLengthOffset)); |
400 } | |
401 } | 397 } |
402 | 398 |
403 | 399 |
404 void StubCompiler::GenerateLoadFunctionPrototype(MacroAssembler* masm, | 400 void StubCompiler::GenerateLoadFunctionPrototype(MacroAssembler* masm, |
405 Register receiver, | 401 Register receiver, |
406 Register scratch1, | 402 Register scratch1, |
407 Register scratch2, | 403 Register scratch2, |
408 Label* miss_label) { | 404 Label* miss_label) { |
409 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label); | 405 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label); |
410 __ Ret(USE_DELAY_SLOT); | 406 __ Ret(USE_DELAY_SLOT); |
(...skipping 2783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3194 // ----------------------------------- | 3190 // ----------------------------------- |
3195 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); | 3191 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); |
3196 } | 3192 } |
3197 | 3193 |
3198 | 3194 |
3199 #undef __ | 3195 #undef __ |
3200 | 3196 |
3201 } } // namespace v8::internal | 3197 } } // namespace v8::internal |
3202 | 3198 |
3203 #endif // V8_TARGET_ARCH_MIPS | 3199 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |