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

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

Issue 146003006: Revert broken ArrayPop changes (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
« no previous file with comments | « src/stub-cache.h ('k') | src/x64/code-stubs-x64.cc » ('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 1264 matching lines...) Expand 10 before | Expand all | Expand 10 after
1275 void CallStubCompiler::GenerateJumpFunction(Handle<Object> object, 1275 void CallStubCompiler::GenerateJumpFunction(Handle<Object> object,
1276 Register actual_closure, 1276 Register actual_closure,
1277 Handle<JSFunction> function) { 1277 Handle<JSFunction> function) {
1278 PatchImplicitReceiver(object); 1278 PatchImplicitReceiver(object);
1279 ParameterCount expected(function); 1279 ParameterCount expected(function);
1280 __ InvokeFunction(actual_closure, expected, arguments(), 1280 __ InvokeFunction(actual_closure, expected, arguments(),
1281 JUMP_FUNCTION, NullCallWrapper()); 1281 JUMP_FUNCTION, NullCallWrapper());
1282 } 1282 }
1283 1283
1284 1284
1285 Handle<Code> CallStubCompiler::CompileArrayPushCall(
1286 Handle<Object> object,
1287 Handle<JSObject> holder,
1288 Handle<Cell> cell,
1289 Handle<JSFunction> function,
1290 Handle<String> name,
1291 Code::StubType type) {
1292 // If object is not an array or is observed or sealed, bail out to regular
1293 // call.
1294 if (!object->IsJSArray() ||
1295 !cell.is_null() ||
1296 Handle<JSArray>::cast(object)->map()->is_observed() ||
1297 !Handle<JSArray>::cast(object)->map()->is_extensible()) {
1298 return Handle<Code>::null();
1299 }
1300
1301 Label miss;
1302
1303 HandlerFrontendHeader(object, holder, name, RECEIVER_MAP_CHECK, &miss);
1304
1305 Handle<Map> map(Handle<JSArray>::cast(object)->map());
1306 ElementsKind elements_kind = map->elements_kind();
1307 const int argc = arguments().immediate();
1308
1309 ArrayPushStub stub(elements_kind, argc);
1310 Handle<Code> code = stub.GetCode(isolate());
1311 StubCompiler::GenerateTailCall(masm(), code);
1312
1313 HandlerFrontendFooter(&miss);
1314
1315 // Return the generated code.
1316 return GetCode(type, name);
1317 }
1318
1319
1285 Handle<Code> CallStubCompiler::CompileCallConstant( 1320 Handle<Code> CallStubCompiler::CompileCallConstant(
1286 Handle<Object> object, 1321 Handle<Object> object,
1287 Handle<JSObject> holder, 1322 Handle<JSObject> holder,
1288 Handle<Name> name, 1323 Handle<Name> name,
1289 CheckType check, 1324 CheckType check,
1290 Handle<JSFunction> function) { 1325 Handle<JSFunction> function) {
1291 if (HasCustomCallGenerator(function)) { 1326 if (HasCustomCallGenerator(function)) {
1292 Handle<Code> code = CompileCustomCall(object, holder, 1327 Handle<Code> code = CompileCustomCall(object, holder,
1293 Handle<Cell>::null(), 1328 Handle<Cell>::null(),
1294 function, Handle<String>::cast(name), 1329 function, Handle<String>::cast(name),
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
1871 ExtraICState extra_state, 1906 ExtraICState extra_state,
1872 InlineCacheHolderFlag cache_holder) 1907 InlineCacheHolderFlag cache_holder)
1873 : StubCompiler(isolate, extra_state), 1908 : StubCompiler(isolate, extra_state),
1874 arguments_(argc), 1909 arguments_(argc),
1875 kind_(kind), 1910 kind_(kind),
1876 cache_holder_(cache_holder) { 1911 cache_holder_(cache_holder) {
1877 } 1912 }
1878 1913
1879 1914
1880 bool CallStubCompiler::HasCustomCallGenerator(Handle<JSFunction> function) { 1915 bool CallStubCompiler::HasCustomCallGenerator(Handle<JSFunction> function) {
1916 if (function->shared()->HasBuiltinFunctionId()) {
1917 BuiltinFunctionId id = function->shared()->builtin_function_id();
1918 #define CALL_GENERATOR_CASE(name) if (id == k##name) return true;
1919 CUSTOM_CALL_IC_GENERATORS(CALL_GENERATOR_CASE)
1920 #undef CALL_GENERATOR_CASE
1921 }
1922
1881 CallOptimization optimization(function); 1923 CallOptimization optimization(function);
1882 return optimization.is_simple_api_call(); 1924 return optimization.is_simple_api_call();
1883 } 1925 }
1884 1926
1885 1927
1886 Handle<Code> CallStubCompiler::CompileCustomCall( 1928 Handle<Code> CallStubCompiler::CompileCustomCall(
1887 Handle<Object> object, 1929 Handle<Object> object,
1888 Handle<JSObject> holder, 1930 Handle<JSObject> holder,
1889 Handle<Cell> cell, 1931 Handle<Cell> cell,
1890 Handle<JSFunction> function, 1932 Handle<JSFunction> function,
1891 Handle<String> fname, 1933 Handle<String> fname,
1892 Code::StubType type) { 1934 Code::StubType type) {
1893 ASSERT(HasCustomCallGenerator(function)); 1935 ASSERT(HasCustomCallGenerator(function));
1936
1937 if (function->shared()->HasBuiltinFunctionId()) {
1938 BuiltinFunctionId id = function->shared()->builtin_function_id();
1939 #define CALL_GENERATOR_CASE(name) \
1940 if (id == k##name) { \
1941 return CallStubCompiler::Compile##name##Call(object, \
1942 holder, \
1943 cell, \
1944 function, \
1945 fname, \
1946 type); \
1947 }
1948 CUSTOM_CALL_IC_GENERATORS(CALL_GENERATOR_CASE)
1949 #undef CALL_GENERATOR_CASE
1950 }
1894 CallOptimization optimization(function); 1951 CallOptimization optimization(function);
1895 ASSERT(optimization.is_simple_api_call()); 1952 ASSERT(optimization.is_simple_api_call());
1896 return CompileFastApiCall(optimization, 1953 return CompileFastApiCall(optimization,
1897 object, 1954 object,
1898 holder, 1955 holder,
1899 cell, 1956 cell,
1900 function, 1957 function,
1901 fname); 1958 fname);
1902 } 1959 }
1903 1960
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
2011 Handle<FunctionTemplateInfo>( 2068 Handle<FunctionTemplateInfo>(
2012 FunctionTemplateInfo::cast(signature->receiver())); 2069 FunctionTemplateInfo::cast(signature->receiver()));
2013 } 2070 }
2014 } 2071 }
2015 2072
2016 is_simple_api_call_ = true; 2073 is_simple_api_call_ = true;
2017 } 2074 }
2018 2075
2019 2076
2020 } } // namespace v8::internal 2077 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/stub-cache.h ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698