Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: src/x64/stub-cache-x64.cc

Issue 23702039: Use regular map-checks to guard string-length loading. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/x64/code-stubs-x64.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 STATIC_ASSERT(kNotStringTag != 0); 297 STATIC_ASSERT(kNotStringTag != 0);
298 __ testl(scratch, Immediate(kNotStringTag)); 298 __ testl(scratch, Immediate(kNotStringTag));
299 __ j(not_zero, non_string_object); 299 __ j(not_zero, non_string_object);
300 } 300 }
301 301
302 302
303 void StubCompiler::GenerateLoadStringLength(MacroAssembler* masm, 303 void StubCompiler::GenerateLoadStringLength(MacroAssembler* masm,
304 Register receiver, 304 Register receiver,
305 Register scratch1, 305 Register scratch1,
306 Register scratch2, 306 Register scratch2,
307 Label* miss, 307 Label* miss) {
308 bool support_wrappers) {
309 Label check_wrapper; 308 Label check_wrapper;
310 309
311 // Check if the object is a string leaving the instance type in the 310 // Check if the object is a string leaving the instance type in the
312 // scratch register. 311 // scratch register.
313 GenerateStringCheck(masm, receiver, scratch1, miss, 312 GenerateStringCheck(masm, receiver, scratch1, miss, &check_wrapper);
314 support_wrappers ? &check_wrapper : miss);
315 313
316 // Load length directly from the string. 314 // Load length directly from the string.
317 __ movq(rax, FieldOperand(receiver, String::kLengthOffset)); 315 __ movq(rax, FieldOperand(receiver, String::kLengthOffset));
318 __ ret(0); 316 __ ret(0);
319 317
320 if (support_wrappers) { 318 // Check if the object is a JSValue wrapper.
321 // Check if the object is a JSValue wrapper. 319 __ bind(&check_wrapper);
322 __ bind(&check_wrapper); 320 __ cmpl(scratch1, Immediate(JS_VALUE_TYPE));
323 __ cmpl(scratch1, Immediate(JS_VALUE_TYPE)); 321 __ j(not_equal, miss);
324 __ j(not_equal, miss);
325 322
326 // Check if the wrapped value is a string and load the length 323 // Check if the wrapped value is a string and load the length
327 // directly if it is. 324 // directly if it is.
328 __ movq(scratch2, FieldOperand(receiver, JSValue::kValueOffset)); 325 __ movq(scratch2, FieldOperand(receiver, JSValue::kValueOffset));
329 GenerateStringCheck(masm, scratch2, scratch1, miss, miss); 326 GenerateStringCheck(masm, scratch2, scratch1, miss, miss);
330 __ movq(rax, FieldOperand(scratch2, String::kLengthOffset)); 327 __ movq(rax, FieldOperand(scratch2, String::kLengthOffset));
331 __ ret(0); 328 __ ret(0);
332 }
333 } 329 }
334 330
335 331
336 void StubCompiler::GenerateLoadFunctionPrototype(MacroAssembler* masm, 332 void StubCompiler::GenerateLoadFunctionPrototype(MacroAssembler* masm,
337 Register receiver, 333 Register receiver,
338 Register result, 334 Register result,
339 Register scratch, 335 Register scratch,
340 Label* miss_label) { 336 Label* miss_label) {
341 __ TryGetFunctionPrototype(receiver, result, miss_label); 337 __ TryGetFunctionPrototype(receiver, result, miss_label);
342 if (!result.is(rax)) __ movq(rax, result); 338 if (!result.is(rax)) __ movq(rax, result);
(...skipping 2819 matching lines...) Expand 10 before | Expand all | Expand 10 after
3162 // ----------------------------------- 3158 // -----------------------------------
3163 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); 3159 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric);
3164 } 3160 }
3165 3161
3166 3162
3167 #undef __ 3163 #undef __
3168 3164
3169 } } // namespace v8::internal 3165 } } // namespace v8::internal
3170 3166
3171 #endif // V8_TARGET_ARCH_X64 3167 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/code-stubs-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698