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

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

Issue 133993010: Merged r18805 into trunk branch. (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 6 years, 11 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') | test/mjsunit/object-seal.js » ('j') | 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 1516 matching lines...) Expand 10 before | Expand all | Expand 10 after
1527 index.translate(holder), Representation::Tagged()); 1527 index.translate(holder), Representation::Tagged());
1528 GenerateJumpFunction(object, rdi, &miss); 1528 GenerateJumpFunction(object, rdi, &miss);
1529 1529
1530 HandlerFrontendFooter(&miss); 1530 HandlerFrontendFooter(&miss);
1531 1531
1532 // Return the generated code. 1532 // Return the generated code.
1533 return GetCode(Code::FAST, name); 1533 return GetCode(Code::FAST, name);
1534 } 1534 }
1535 1535
1536 1536
1537 Handle<Code> CallStubCompiler::CompileArrayPopCall(
1538 Handle<Object> object,
1539 Handle<JSObject> holder,
1540 Handle<Cell> cell,
1541 Handle<JSFunction> function,
1542 Handle<String> name,
1543 Code::StubType type) {
1544 // If object is not an array or is observed or sealed, bail out to regular
1545 // call.
1546 if (!object->IsJSArray() ||
1547 !cell.is_null() ||
1548 Handle<JSArray>::cast(object)->map()->is_observed() ||
1549 !Handle<JSArray>::cast(object)->map()->is_extensible()) {
1550 return Handle<Code>::null();
1551 }
1552
1553 Label miss, return_undefined, call_builtin;
1554
1555 HandlerFrontendHeader(object, holder, name, RECEIVER_MAP_CHECK, &miss);
1556
1557 // Get the elements array of the object.
1558 __ movp(rbx, FieldOperand(rdx, JSArray::kElementsOffset));
1559
1560 // Check that the elements are in fast mode and writable.
1561 __ CompareRoot(FieldOperand(rbx, HeapObject::kMapOffset),
1562 Heap::kFixedArrayMapRootIndex);
1563 __ j(not_equal, &call_builtin);
1564
1565 // Get the array's length into rcx and calculate new length.
1566 __ SmiToInteger32(rcx, FieldOperand(rdx, JSArray::kLengthOffset));
1567 __ subl(rcx, Immediate(1));
1568 __ j(negative, &return_undefined);
1569
1570 // Get the last element.
1571 __ LoadRoot(r9, Heap::kTheHoleValueRootIndex);
1572 __ movp(rax, FieldOperand(rbx,
1573 rcx, times_pointer_size,
1574 FixedArray::kHeaderSize));
1575 // Check if element is already the hole.
1576 __ cmpq(rax, r9);
1577 // If so, call slow-case to also check prototypes for value.
1578 __ j(equal, &call_builtin);
1579
1580 // Set the array's length.
1581 __ Integer32ToSmiField(FieldOperand(rdx, JSArray::kLengthOffset), rcx);
1582
1583 // Fill with the hole and return original value.
1584 __ movp(FieldOperand(rbx,
1585 rcx, times_pointer_size,
1586 FixedArray::kHeaderSize),
1587 r9);
1588 const int argc = arguments().immediate();
1589 __ ret((argc + 1) * kPointerSize);
1590
1591 __ bind(&return_undefined);
1592 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex);
1593 __ ret((argc + 1) * kPointerSize);
1594
1595 __ bind(&call_builtin);
1596 __ TailCallExternalReference(
1597 ExternalReference(Builtins::c_ArrayPop, isolate()),
1598 argc + 1,
1599 1);
1600
1601 HandlerFrontendFooter(&miss);
1602
1603 // Return the generated code.
1604 return GetCode(type, name);
1605 }
1606
1607
1537 Handle<Code> CallStubCompiler::CompileFastApiCall( 1608 Handle<Code> CallStubCompiler::CompileFastApiCall(
1538 const CallOptimization& optimization, 1609 const CallOptimization& optimization,
1539 Handle<Object> object, 1610 Handle<Object> object,
1540 Handle<JSObject> holder, 1611 Handle<JSObject> holder,
1541 Handle<Cell> cell, 1612 Handle<Cell> cell,
1542 Handle<JSFunction> function, 1613 Handle<JSFunction> function,
1543 Handle<String> name) { 1614 Handle<String> name) {
1544 ASSERT(optimization.is_simple_api_call()); 1615 ASSERT(optimization.is_simple_api_call());
1545 // Bail out if object is a global object as we don't want to 1616 // Bail out if object is a global object as we don't want to
1546 // repatch it to global receiver. 1617 // repatch it to global receiver.
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
2111 // ----------------------------------- 2182 // -----------------------------------
2112 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); 2183 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss);
2113 } 2184 }
2114 2185
2115 2186
2116 #undef __ 2187 #undef __
2117 2188
2118 } } // namespace v8::internal 2189 } } // namespace v8::internal
2119 2190
2120 #endif // V8_TARGET_ARCH_X64 2191 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/code-stubs-x64.cc ('k') | test/mjsunit/object-seal.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698