| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 | 94 |
| 95 // Create the code object. | 95 // Create the code object. |
| 96 CodeDesc desc; | 96 CodeDesc desc; |
| 97 masm.GetCode(&desc); | 97 masm.GetCode(&desc); |
| 98 | 98 |
| 99 // Copy the generated code into a heap object. | 99 // Copy the generated code into a heap object. |
| 100 Code::Flags flags = Code::ComputeFlags( | 100 Code::Flags flags = Code::ComputeFlags( |
| 101 static_cast<Code::Kind>(GetCodeKind()), | 101 static_cast<Code::Kind>(GetCodeKind()), |
| 102 InLoop(), | 102 InLoop(), |
| 103 GetICState()); | 103 GetICState()); |
| 104 Handle<Code> new_object = Factory::NewCode(desc, flags, masm.CodeObject()); | 104 Handle<Code> new_object = Factory::NewCode( |
| 105 desc, flags, masm.CodeObject(), NeedsImmovableCode()); |
| 105 RecordCodeGeneration(*new_object, &masm); | 106 RecordCodeGeneration(*new_object, &masm); |
| 106 FinishCode(*new_object); | 107 FinishCode(*new_object); |
| 107 | 108 |
| 108 // Update the dictionary and the root in Heap. | 109 // Update the dictionary and the root in Heap. |
| 109 Handle<NumberDictionary> dict = | 110 Handle<NumberDictionary> dict = |
| 110 Factory::DictionaryAtNumberPut( | 111 Factory::DictionaryAtNumberPut( |
| 111 Handle<NumberDictionary>(Heap::code_stubs()), | 112 Handle<NumberDictionary>(Heap::code_stubs()), |
| 112 GetKey(), | 113 GetKey(), |
| 113 new_object); | 114 new_object); |
| 114 Heap::public_set_code_stubs(*dict); | 115 Heap::public_set_code_stubs(*dict); |
| 115 | 116 |
| 116 code = *new_object; | 117 code = *new_object; |
| 117 } | 118 } |
| 118 | 119 |
| 120 ASSERT(!NeedsImmovableCode() || Heap::lo_space()->Contains(code)); |
| 119 return Handle<Code>(code); | 121 return Handle<Code>(code); |
| 120 } | 122 } |
| 121 | 123 |
| 122 | 124 |
| 123 MaybeObject* CodeStub::TryGetCode() { | 125 MaybeObject* CodeStub::TryGetCode() { |
| 124 Code* code; | 126 Code* code; |
| 125 if (!FindCodeInCache(&code)) { | 127 if (!FindCodeInCache(&code)) { |
| 126 // Generate the new code. | 128 // Generate the new code. |
| 127 MacroAssembler masm(NULL, 256); | 129 MacroAssembler masm(NULL, 256); |
| 128 GenerateCode(&masm); | 130 GenerateCode(&masm); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 OS::SNPrintF(Vector<char>(name_, kMaxNameLength), | 223 OS::SNPrintF(Vector<char>(name_, kMaxNameLength), |
| 222 "InstanceofStub%s%s%s", | 224 "InstanceofStub%s%s%s", |
| 223 args, | 225 args, |
| 224 inline_check, | 226 inline_check, |
| 225 return_true_false_object); | 227 return_true_false_object); |
| 226 return name_; | 228 return name_; |
| 227 } | 229 } |
| 228 | 230 |
| 229 | 231 |
| 230 } } // namespace v8::internal | 232 } } // namespace v8::internal |
| OLD | NEW |