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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 STATIC_ASSERT(kNotStringTag != 0); | 322 STATIC_ASSERT(kNotStringTag != 0); |
323 __ test(scratch, Immediate(kNotStringTag)); | 323 __ test(scratch, Immediate(kNotStringTag)); |
324 __ j(not_zero, non_string_object); | 324 __ j(not_zero, non_string_object); |
325 } | 325 } |
326 | 326 |
327 | 327 |
328 void StubCompiler::GenerateLoadStringLength(MacroAssembler* masm, | 328 void StubCompiler::GenerateLoadStringLength(MacroAssembler* masm, |
329 Register receiver, | 329 Register receiver, |
330 Register scratch1, | 330 Register scratch1, |
331 Register scratch2, | 331 Register scratch2, |
332 Label* miss, | 332 Label* miss) { |
333 bool support_wrappers) { | |
334 Label check_wrapper; | 333 Label check_wrapper; |
335 | 334 |
336 // Check if the object is a string leaving the instance type in the | 335 // Check if the object is a string leaving the instance type in the |
337 // scratch register. | 336 // scratch register. |
338 GenerateStringCheck(masm, receiver, scratch1, miss, | 337 GenerateStringCheck(masm, receiver, scratch1, miss, &check_wrapper); |
339 support_wrappers ? &check_wrapper : miss); | |
340 | 338 |
341 // Load length from the string and convert to a smi. | 339 // Load length from the string and convert to a smi. |
342 __ mov(eax, FieldOperand(receiver, String::kLengthOffset)); | 340 __ mov(eax, FieldOperand(receiver, String::kLengthOffset)); |
343 __ ret(0); | 341 __ ret(0); |
344 | 342 |
345 if (support_wrappers) { | 343 // Check if the object is a JSValue wrapper. |
346 // Check if the object is a JSValue wrapper. | 344 __ bind(&check_wrapper); |
347 __ bind(&check_wrapper); | 345 __ cmp(scratch1, JS_VALUE_TYPE); |
348 __ cmp(scratch1, JS_VALUE_TYPE); | 346 __ j(not_equal, miss); |
349 __ j(not_equal, miss); | |
350 | 347 |
351 // Check if the wrapped value is a string and load the length | 348 // Check if the wrapped value is a string and load the length |
352 // directly if it is. | 349 // directly if it is. |
353 __ mov(scratch2, FieldOperand(receiver, JSValue::kValueOffset)); | 350 __ mov(scratch2, FieldOperand(receiver, JSValue::kValueOffset)); |
354 GenerateStringCheck(masm, scratch2, scratch1, miss, miss); | 351 GenerateStringCheck(masm, scratch2, scratch1, miss, miss); |
355 __ mov(eax, FieldOperand(scratch2, String::kLengthOffset)); | 352 __ mov(eax, FieldOperand(scratch2, String::kLengthOffset)); |
356 __ ret(0); | 353 __ ret(0); |
357 } | |
358 } | 354 } |
359 | 355 |
360 | 356 |
361 void StubCompiler::GenerateLoadFunctionPrototype(MacroAssembler* masm, | 357 void StubCompiler::GenerateLoadFunctionPrototype(MacroAssembler* masm, |
362 Register receiver, | 358 Register receiver, |
363 Register scratch1, | 359 Register scratch1, |
364 Register scratch2, | 360 Register scratch2, |
365 Label* miss_label) { | 361 Label* miss_label) { |
366 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label); | 362 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label); |
367 __ mov(eax, scratch1); | 363 __ mov(eax, scratch1); |
(...skipping 2900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3268 // ----------------------------------- | 3264 // ----------------------------------- |
3269 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); | 3265 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); |
3270 } | 3266 } |
3271 | 3267 |
3272 | 3268 |
3273 #undef __ | 3269 #undef __ |
3274 | 3270 |
3275 } } // namespace v8::internal | 3271 } } // namespace v8::internal |
3276 | 3272 |
3277 #endif // V8_TARGET_ARCH_IA32 | 3273 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |