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

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

Issue 137783023: Add hydrogen support for ArrayPop, and remove the handwritten call stubs. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
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
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 1893 matching lines...) Expand 10 before | Expand all | Expand 10 after
1904 1); 1904 1);
1905 } 1905 }
1906 1906
1907 HandlerFrontendFooter(&miss); 1907 HandlerFrontendFooter(&miss);
1908 1908
1909 // Return the generated code. 1909 // Return the generated code.
1910 return GetCode(type, name); 1910 return GetCode(type, name);
1911 } 1911 }
1912 1912
1913 1913
1914 Handle<Code> CallStubCompiler::CompileArrayPopCall(
1915 Handle<Object> object,
1916 Handle<JSObject> holder,
1917 Handle<Cell> cell,
1918 Handle<JSFunction> function,
1919 Handle<String> name,
1920 Code::StubType type) {
1921 // If object is not an array or is observed or sealed, bail out to regular
1922 // call.
1923 if (!object->IsJSArray() ||
1924 !cell.is_null() ||
1925 Handle<JSArray>::cast(object)->map()->is_observed() ||
1926 !Handle<JSArray>::cast(object)->map()->is_extensible()) {
1927 return Handle<Code>::null();
1928 }
1929
1930 Label miss, return_undefined, call_builtin;
1931
1932 HandlerFrontendHeader(object, holder, name, RECEIVER_MAP_CHECK, &miss);
1933
1934 // Get the elements array of the object.
1935 __ mov(ebx, FieldOperand(edx, JSArray::kElementsOffset));
1936
1937 // Check that the elements are in fast mode and writable.
1938 __ cmp(FieldOperand(ebx, HeapObject::kMapOffset),
1939 Immediate(factory()->fixed_array_map()));
1940 __ j(not_equal, &call_builtin);
1941
1942 // Get the array's length into ecx and calculate new length.
1943 __ mov(ecx, FieldOperand(edx, JSArray::kLengthOffset));
1944 __ sub(ecx, Immediate(Smi::FromInt(1)));
1945 __ j(negative, &return_undefined);
1946
1947 // Get the last element.
1948 STATIC_ASSERT(kSmiTagSize == 1);
1949 STATIC_ASSERT(kSmiTag == 0);
1950 __ mov(eax, FieldOperand(ebx,
1951 ecx, times_half_pointer_size,
1952 FixedArray::kHeaderSize));
1953 __ cmp(eax, Immediate(factory()->the_hole_value()));
1954 __ j(equal, &call_builtin);
1955
1956 // Set the array's length.
1957 __ mov(FieldOperand(edx, JSArray::kLengthOffset), ecx);
1958
1959 // Fill with the hole.
1960 __ mov(FieldOperand(ebx,
1961 ecx, times_half_pointer_size,
1962 FixedArray::kHeaderSize),
1963 Immediate(factory()->the_hole_value()));
1964 const int argc = arguments().immediate();
1965 __ ret((argc + 1) * kPointerSize);
1966
1967 __ bind(&return_undefined);
1968 __ mov(eax, Immediate(factory()->undefined_value()));
1969 __ ret((argc + 1) * kPointerSize);
1970
1971 __ bind(&call_builtin);
1972 __ TailCallExternalReference(
1973 ExternalReference(Builtins::c_ArrayPop, isolate()),
1974 argc + 1,
1975 1);
1976
1977 HandlerFrontendFooter(&miss);
1978
1979 // Return the generated code.
1980 return GetCode(type, name);
1981 }
1982
1983
1984 Handle<Code> CallStubCompiler::CompileFastApiCall( 1914 Handle<Code> CallStubCompiler::CompileFastApiCall(
1985 const CallOptimization& optimization, 1915 const CallOptimization& optimization,
1986 Handle<Object> object, 1916 Handle<Object> object,
1987 Handle<JSObject> holder, 1917 Handle<JSObject> holder,
1988 Handle<Cell> cell, 1918 Handle<Cell> cell,
1989 Handle<JSFunction> function, 1919 Handle<JSFunction> function,
1990 Handle<String> name) { 1920 Handle<String> name) {
1991 ASSERT(optimization.is_simple_api_call()); 1921 ASSERT(optimization.is_simple_api_call());
1992 // Bail out if object is a global object as we don't want to 1922 // Bail out if object is a global object as we don't want to
1993 // repatch it to global receiver. 1923 // repatch it to global receiver.
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
2575 // ----------------------------------- 2505 // -----------------------------------
2576 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); 2506 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss);
2577 } 2507 }
2578 2508
2579 2509
2580 #undef __ 2510 #undef __
2581 2511
2582 } } // namespace v8::internal 2512 } } // namespace v8::internal
2583 2513
2584 #endif // V8_TARGET_ARCH_IA32 2514 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« src/hydrogen.cc ('K') | « src/hydrogen.cc ('k') | src/mips/stub-cache-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698