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

Side by Side Diff: src/x64/lithium-codegen-x64.cc

Issue 6371019: x64: Implemented object, array and function literals in lithium codegen. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge/src/x64
Patch Set: Created 9 years, 10 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 | « no previous file | src/x64/lithium-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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 if (code->kind() == Code::TYPE_RECORDING_BINARY_OP_IC || 357 if (code->kind() == Code::TYPE_RECORDING_BINARY_OP_IC ||
358 code->kind() == Code::COMPARE_IC) { 358 code->kind() == Code::COMPARE_IC) {
359 __ nop(); 359 __ nop();
360 } 360 }
361 } 361 }
362 362
363 363
364 void LCodeGen::CallRuntime(Runtime::Function* function, 364 void LCodeGen::CallRuntime(Runtime::Function* function,
365 int num_arguments, 365 int num_arguments,
366 LInstruction* instr) { 366 LInstruction* instr) {
367 Abort("Unimplemented: %s", "CallRuntime"); 367 ASSERT(instr != NULL);
368 ASSERT(instr->HasPointerMap());
369 LPointerMap* pointers = instr->pointer_map();
370 RecordPosition(pointers->position());
371
372 __ CallRuntime(function, num_arguments);
373 RegisterLazyDeoptimization(instr);
368 } 374 }
369 375
370 376
371 void LCodeGen::RegisterLazyDeoptimization(LInstruction* instr) { 377 void LCodeGen::RegisterLazyDeoptimization(LInstruction* instr) {
372 // Create the environment to bailout to. If the call has side effects 378 // Create the environment to bailout to. If the call has side effects
373 // execution has to continue after the call otherwise execution can continue 379 // execution has to continue after the call otherwise execution can continue
374 // from a previous bailout point repeating the call. 380 // from a previous bailout point repeating the call.
375 LEnvironment* deoptimization_environment; 381 LEnvironment* deoptimization_environment;
376 if (instr->HasDeoptimizationEnvironment()) { 382 if (instr->HasDeoptimizationEnvironment()) {
377 deoptimization_environment = instr->deoptimization_environment(); 383 deoptimization_environment = instr->deoptimization_environment();
(...skipping 1544 matching lines...) Expand 10 before | Expand all | Expand 10 after
1922 } 1928 }
1923 1929
1924 // Check the holder map. 1930 // Check the holder map.
1925 __ Cmp(FieldOperand(reg, HeapObject::kMapOffset), 1931 __ Cmp(FieldOperand(reg, HeapObject::kMapOffset),
1926 Handle<Map>(current_prototype->map())); 1932 Handle<Map>(current_prototype->map()));
1927 DeoptimizeIf(not_equal, instr->environment()); 1933 DeoptimizeIf(not_equal, instr->environment());
1928 } 1934 }
1929 1935
1930 1936
1931 void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) { 1937 void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) {
1932 Abort("Unimplemented: %s", "DoArrayLiteral"); 1938 // Setup the parameters to the stub/runtime call.
1939 __ movq(rax, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
1940 __ push(FieldOperand(rax, JSFunction::kLiteralsOffset));
1941 __ Push(Smi::FromInt(instr->hydrogen()->literal_index()));
1942 __ Push(instr->hydrogen()->constant_elements());
1943
1944 // Pick the right runtime function or stub to call.
1945 int length = instr->hydrogen()->length();
1946 if (instr->hydrogen()->IsCopyOnWrite()) {
1947 ASSERT(instr->hydrogen()->depth() == 1);
1948 FastCloneShallowArrayStub::Mode mode =
1949 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS;
1950 FastCloneShallowArrayStub stub(mode, length);
1951 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
1952 } else if (instr->hydrogen()->depth() > 1) {
1953 CallRuntime(Runtime::kCreateArrayLiteral, 3, instr);
1954 } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) {
1955 CallRuntime(Runtime::kCreateArrayLiteralShallow, 3, instr);
1956 } else {
1957 FastCloneShallowArrayStub::Mode mode =
1958 FastCloneShallowArrayStub::CLONE_ELEMENTS;
1959 FastCloneShallowArrayStub stub(mode, length);
1960 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
1961 }
1933 } 1962 }
1934 1963
1935 1964
1936 void LCodeGen::DoObjectLiteral(LObjectLiteral* instr) { 1965 void LCodeGen::DoObjectLiteral(LObjectLiteral* instr) {
1937 Abort("Unimplemented: %s", "DoObjectLiteral"); 1966 // Setup the parameters to the stub/runtime call.
1967 __ movq(rax, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
1968 __ push(FieldOperand(rax, JSFunction::kLiteralsOffset));
1969 __ Push(Smi::FromInt(instr->hydrogen()->literal_index()));
1970 __ Push(instr->hydrogen()->constant_properties());
1971 __ Push(Smi::FromInt(instr->hydrogen()->fast_elements() ? 1 : 0));
1972
1973 // Pick the right runtime function to call.
1974 if (instr->hydrogen()->depth() > 1) {
1975 CallRuntime(Runtime::kCreateObjectLiteral, 4, instr);
1976 } else {
1977 CallRuntime(Runtime::kCreateObjectLiteralShallow, 4, instr);
1978 }
1938 } 1979 }
1939 1980
1940 1981
1941 void LCodeGen::DoRegExpLiteral(LRegExpLiteral* instr) { 1982 void LCodeGen::DoRegExpLiteral(LRegExpLiteral* instr) {
1942 Abort("Unimplemented: %s", "DoRegExpLiteral"); 1983 Abort("Unimplemented: %s", "DoRegExpLiteral");
1943 } 1984 }
1944 1985
1945 1986
1946 void LCodeGen::DoFunctionLiteral(LFunctionLiteral* instr) { 1987 void LCodeGen::DoFunctionLiteral(LFunctionLiteral* instr) {
1947 Abort("Unimplemented: %s", "DoFunctionLiteral"); 1988 // Use the fast case closure allocation code that allocates in new
1989 // space for nested functions that don't need literals cloning.
1990 Handle<SharedFunctionInfo> shared_info = instr->shared_info();
1991 bool pretenure = instr->hydrogen()->pretenure();
1992 if (shared_info->num_literals() == 0 && !pretenure) {
1993 FastNewClosureStub stub;
1994 __ Push(shared_info);
1995 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
1996 } else {
1997 __ push(rsi);
1998 __ Push(shared_info);
1999 __ Push(pretenure ? Factory::true_value() : Factory::false_value());
2000 CallRuntime(Runtime::kNewClosure, 3, instr);
2001 }
1948 } 2002 }
1949 2003
1950 2004
1951 void LCodeGen::DoTypeof(LTypeof* instr) { 2005 void LCodeGen::DoTypeof(LTypeof* instr) {
1952 Abort("Unimplemented: %s", "DoTypeof"); 2006 Abort("Unimplemented: %s", "DoTypeof");
1953 } 2007 }
1954 2008
1955 2009
1956 void LCodeGen::DoTypeofIs(LTypeofIs* instr) { 2010 void LCodeGen::DoTypeofIs(LTypeofIs* instr) {
1957 Abort("Unimplemented: %s", "DoTypeofIs"); 2011 Abort("Unimplemented: %s", "DoTypeofIs");
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
2069 2123
2070 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { 2124 void LCodeGen::DoOsrEntry(LOsrEntry* instr) {
2071 Abort("Unimplemented: %s", "DoOsrEntry"); 2125 Abort("Unimplemented: %s", "DoOsrEntry");
2072 } 2126 }
2073 2127
2074 #undef __ 2128 #undef __
2075 2129
2076 } } // namespace v8::internal 2130 } } // namespace v8::internal
2077 2131
2078 #endif // V8_TARGET_ARCH_X64 2132 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « no previous file | src/x64/lithium-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698