OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 __ movq(scratch, FieldOperand(receiver, HeapObject::kMapOffset)); | 307 __ movq(scratch, FieldOperand(receiver, HeapObject::kMapOffset)); |
308 __ movzxbq(scratch, FieldOperand(scratch, Map::kInstanceTypeOffset)); | 308 __ movzxbq(scratch, FieldOperand(scratch, Map::kInstanceTypeOffset)); |
309 ASSERT(kNotStringTag != 0); | 309 ASSERT(kNotStringTag != 0); |
310 __ testl(scratch, Immediate(kNotStringTag)); | 310 __ testl(scratch, Immediate(kNotStringTag)); |
311 __ j(not_zero, non_string_object); | 311 __ j(not_zero, non_string_object); |
312 } | 312 } |
313 | 313 |
314 | 314 |
315 void StubCompiler::GenerateLoadStringLength(MacroAssembler* masm, | 315 void StubCompiler::GenerateLoadStringLength(MacroAssembler* masm, |
316 Register receiver, | 316 Register receiver, |
317 Register scratch, | 317 Register scratch1, |
| 318 Register scratch2, |
318 Label* miss) { | 319 Label* miss) { |
319 Label load_length, check_wrapper; | 320 Label load_length, check_wrapper; |
320 | 321 |
321 // Check if the object is a string leaving the instance type in the | 322 // Check if the object is a string leaving the instance type in the |
322 // scratch register. | 323 // scratch register. |
323 GenerateStringCheck(masm, receiver, scratch, miss, &check_wrapper); | 324 GenerateStringCheck(masm, receiver, scratch1, miss, &check_wrapper); |
324 | 325 |
325 // Load length directly from the string. | 326 // Load length directly from the string. |
326 __ bind(&load_length); | 327 __ bind(&load_length); |
327 __ movl(rax, FieldOperand(receiver, String::kLengthOffset)); | 328 __ movl(rax, FieldOperand(receiver, String::kLengthOffset)); |
328 __ Integer32ToSmi(rax, rax); | 329 __ Integer32ToSmi(rax, rax); |
329 __ ret(0); | 330 __ ret(0); |
330 | 331 |
331 // Check if the object is a JSValue wrapper. | 332 // Check if the object is a JSValue wrapper. |
332 __ bind(&check_wrapper); | 333 __ bind(&check_wrapper); |
333 __ cmpl(scratch, Immediate(JS_VALUE_TYPE)); | 334 __ cmpl(scratch1, Immediate(JS_VALUE_TYPE)); |
334 __ j(not_equal, miss); | 335 __ j(not_equal, miss); |
335 | 336 |
336 // Check if the wrapped value is a string and load the length | 337 // Check if the wrapped value is a string and load the length |
337 // directly if it is. | 338 // directly if it is. |
338 __ movq(receiver, FieldOperand(receiver, JSValue::kValueOffset)); | 339 __ movq(scratch2, FieldOperand(receiver, JSValue::kValueOffset)); |
339 GenerateStringCheck(masm, receiver, scratch, miss, miss); | 340 GenerateStringCheck(masm, scratch2, scratch1, miss, miss); |
| 341 __ movq(receiver, scratch2); |
340 __ jmp(&load_length); | 342 __ jmp(&load_length); |
341 } | 343 } |
342 | 344 |
343 | 345 |
344 template <class Pushable> | 346 template <class Pushable> |
345 static void CompileCallLoadPropertyWithInterceptor(MacroAssembler* masm, | 347 static void CompileCallLoadPropertyWithInterceptor(MacroAssembler* masm, |
346 Register receiver, | 348 Register receiver, |
347 Register holder, | 349 Register holder, |
348 Pushable name, | 350 Pushable name, |
349 JSObject* holder_obj) { | 351 JSObject* holder_obj) { |
(...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1318 Label miss; | 1320 Label miss; |
1319 | 1321 |
1320 __ movq(rax, Operand(rsp, kPointerSize)); | 1322 __ movq(rax, Operand(rsp, kPointerSize)); |
1321 __ movq(rcx, Operand(rsp, 2 * kPointerSize)); | 1323 __ movq(rcx, Operand(rsp, 2 * kPointerSize)); |
1322 __ IncrementCounter(&Counters::keyed_load_string_length, 1); | 1324 __ IncrementCounter(&Counters::keyed_load_string_length, 1); |
1323 | 1325 |
1324 // Check that the name has not changed. | 1326 // Check that the name has not changed. |
1325 __ Cmp(rax, Handle<String>(name)); | 1327 __ Cmp(rax, Handle<String>(name)); |
1326 __ j(not_equal, &miss); | 1328 __ j(not_equal, &miss); |
1327 | 1329 |
1328 GenerateLoadStringLength(masm(), rcx, rdx, &miss); | 1330 GenerateLoadStringLength(masm(), rcx, rdx, rbx, &miss); |
1329 __ bind(&miss); | 1331 __ bind(&miss); |
1330 __ DecrementCounter(&Counters::keyed_load_string_length, 1); | 1332 __ DecrementCounter(&Counters::keyed_load_string_length, 1); |
1331 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 1333 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
1332 | 1334 |
1333 // Return the generated code. | 1335 // Return the generated code. |
1334 return GetCode(CALLBACKS, name); | 1336 return GetCode(CALLBACKS, name); |
1335 } | 1337 } |
1336 | 1338 |
1337 | 1339 |
1338 Object* StoreStubCompiler::CompileStoreCallback(JSObject* object, | 1340 Object* StoreStubCompiler::CompileStoreCallback(JSObject* object, |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1865 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); | 1867 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); |
1866 | 1868 |
1867 // Return the generated code. | 1869 // Return the generated code. |
1868 return GetCode(); | 1870 return GetCode(); |
1869 } | 1871 } |
1870 | 1872 |
1871 | 1873 |
1872 #undef __ | 1874 #undef __ |
1873 | 1875 |
1874 } } // namespace v8::internal | 1876 } } // namespace v8::internal |
OLD | NEW |