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