| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 function = JSFunction::cast(opt); | 443 function = JSFunction::cast(opt); |
| 444 } | 444 } |
| 445 } | 445 } |
| 446 // If the function hasn't been compiled yet, we cannot do it now | 446 // If the function hasn't been compiled yet, we cannot do it now |
| 447 // because it may cause GC. To avoid this issue, we return an | 447 // because it may cause GC. To avoid this issue, we return an |
| 448 // internal error which will make sure we do not update any | 448 // internal error which will make sure we do not update any |
| 449 // caches. | 449 // caches. |
| 450 if (!function->is_compiled()) return Failure::InternalError(); | 450 if (!function->is_compiled()) return Failure::InternalError(); |
| 451 // Compile the stub - only create stubs for fully compiled functions. | 451 // Compile the stub - only create stubs for fully compiled functions. |
| 452 CallStubCompiler compiler(argc, in_loop); | 452 CallStubCompiler compiler(argc, in_loop); |
| 453 code = compiler.CompileCallConstant(object, holder, function, check); | 453 code = compiler.CompileCallConstant(object, holder, function, name, check); |
| 454 if (code->IsFailure()) return code; | 454 if (code->IsFailure()) return code; |
| 455 ASSERT_EQ(flags, Code::cast(code)->flags()); | 455 ASSERT_EQ(flags, Code::cast(code)->flags()); |
| 456 LOG(CodeCreateEvent(Logger::CALL_IC_TAG, Code::cast(code), name)); | 456 LOG(CodeCreateEvent(Logger::CALL_IC_TAG, Code::cast(code), name)); |
| 457 Object* result = map->UpdateCodeCache(name, Code::cast(code)); | 457 Object* result = map->UpdateCodeCache(name, Code::cast(code)); |
| 458 if (result->IsFailure()) return result; | 458 if (result->IsFailure()) return result; |
| 459 } | 459 } |
| 460 return Set(name, map, Code::cast(code)); | 460 return Set(name, map, Code::cast(code)); |
| 461 } | 461 } |
| 462 | 462 |
| 463 | 463 |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 950 USE(code); | 950 USE(code); |
| 951 LOG(CodeCreateEvent(Logger::CALL_DEBUG_PREPARE_STEP_IN_TAG, | 951 LOG(CodeCreateEvent(Logger::CALL_DEBUG_PREPARE_STEP_IN_TAG, |
| 952 code, code->arguments_count())); | 952 code, code->arguments_count())); |
| 953 } | 953 } |
| 954 return result; | 954 return result; |
| 955 } | 955 } |
| 956 #endif | 956 #endif |
| 957 | 957 |
| 958 | 958 |
| 959 Object* StubCompiler::GetCodeWithFlags(Code::Flags flags, const char* name) { | 959 Object* StubCompiler::GetCodeWithFlags(Code::Flags flags, const char* name) { |
| 960 // Check for allocation failures during stub compilation. |
| 961 if (failure_->IsFailure()) return failure_; |
| 962 |
| 963 // Create code object in the heap. |
| 960 CodeDesc desc; | 964 CodeDesc desc; |
| 961 masm_.GetCode(&desc); | 965 masm_.GetCode(&desc); |
| 962 Object* result = Heap::CreateCode(desc, NULL, flags, masm_.CodeObject()); | 966 Object* result = Heap::CreateCode(desc, NULL, flags, masm_.CodeObject()); |
| 963 #ifdef ENABLE_DISASSEMBLER | 967 #ifdef ENABLE_DISASSEMBLER |
| 964 if (FLAG_print_code_stubs && !result->IsFailure()) { | 968 if (FLAG_print_code_stubs && !result->IsFailure()) { |
| 965 Code::cast(result)->Disassemble(name); | 969 Code::cast(result)->Disassemble(name); |
| 966 } | 970 } |
| 967 #endif | 971 #endif |
| 968 return result; | 972 return result; |
| 969 } | 973 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1005 int argc = arguments_.immediate(); | 1009 int argc = arguments_.immediate(); |
| 1006 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::CALL_IC, | 1010 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::CALL_IC, |
| 1007 type, | 1011 type, |
| 1008 in_loop_, | 1012 in_loop_, |
| 1009 argc); | 1013 argc); |
| 1010 return GetCodeWithFlags(flags, name); | 1014 return GetCodeWithFlags(flags, name); |
| 1011 } | 1015 } |
| 1012 | 1016 |
| 1013 | 1017 |
| 1014 } } // namespace v8::internal | 1018 } } // namespace v8::internal |
| OLD | NEW |