OLD | NEW |
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 | 60 |
61 void CodeStub::RecordCodeGeneration(Code* code, Isolate* isolate) { | 61 void CodeStub::RecordCodeGeneration(Code* code, Isolate* isolate) { |
62 SmartArrayPointer<const char> name = GetName(); | 62 SmartArrayPointer<const char> name = GetName(); |
63 PROFILE(isolate, CodeCreateEvent(Logger::STUB_TAG, code, *name)); | 63 PROFILE(isolate, CodeCreateEvent(Logger::STUB_TAG, code, *name)); |
64 GDBJIT(AddCode(GDBJITInterface::STUB, *name, code)); | 64 GDBJIT(AddCode(GDBJITInterface::STUB, *name, code)); |
65 Counters* counters = isolate->counters(); | 65 Counters* counters = isolate->counters(); |
66 counters->total_stubs_code_size()->Increment(code->instruction_size()); | 66 counters->total_stubs_code_size()->Increment(code->instruction_size()); |
67 } | 67 } |
68 | 68 |
69 | 69 |
70 int CodeStub::GetCodeKind() { | 70 Code::Kind CodeStub::GetCodeKind() const { |
71 return Code::STUB; | 71 return Code::STUB; |
72 } | 72 } |
73 | 73 |
74 | 74 |
75 Handle<Code> PlatformCodeStub::GenerateCode() { | 75 Handle<Code> PlatformCodeStub::GenerateCode() { |
76 Isolate* isolate = Isolate::Current(); | 76 Isolate* isolate = Isolate::Current(); |
77 Factory* factory = isolate->factory(); | 77 Factory* factory = isolate->factory(); |
78 | 78 |
79 // Generate the new code. | 79 // Generate the new code. |
80 MacroAssembler masm(isolate, NULL, 256); | 80 MacroAssembler masm(isolate, NULL, 256); |
(...skipping 10 matching lines...) Expand all Loading... |
91 NoCurrentFrameScope scope(&masm); | 91 NoCurrentFrameScope scope(&masm); |
92 Generate(&masm); | 92 Generate(&masm); |
93 } | 93 } |
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 GetCodeKind(), |
102 GetICState(), | 102 GetICState(), |
103 GetExtraICState(), | 103 GetExtraICState(), |
104 GetStubType(), | 104 GetStubType(), |
105 GetStubFlags()); | 105 GetStubFlags()); |
106 Handle<Code> new_object = factory->NewCode( | 106 Handle<Code> new_object = factory->NewCode( |
107 desc, flags, masm.CodeObject(), NeedsImmovableCode()); | 107 desc, flags, masm.CodeObject(), NeedsImmovableCode()); |
108 return new_object; | 108 return new_object; |
109 } | 109 } |
110 | 110 |
111 | 111 |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 strict() ? | 301 strict() ? |
302 factory->strict_compare_ic_string() : | 302 factory->strict_compare_ic_string() : |
303 factory->compare_ic_string(), | 303 factory->compare_ic_string(), |
304 new_object); | 304 new_object); |
305 } | 305 } |
306 | 306 |
307 | 307 |
308 bool ICCompareStub::FindCodeInSpecialCache(Code** code_out, Isolate* isolate) { | 308 bool ICCompareStub::FindCodeInSpecialCache(Code** code_out, Isolate* isolate) { |
309 Factory* factory = isolate->factory(); | 309 Factory* factory = isolate->factory(); |
310 Code::Flags flags = Code::ComputeFlags( | 310 Code::Flags flags = Code::ComputeFlags( |
311 static_cast<Code::Kind>(GetCodeKind()), | 311 GetCodeKind(), |
312 UNINITIALIZED); | 312 UNINITIALIZED); |
313 ASSERT(op_ == Token::EQ || op_ == Token::EQ_STRICT); | 313 ASSERT(op_ == Token::EQ || op_ == Token::EQ_STRICT); |
314 Handle<Object> probe( | 314 Handle<Object> probe( |
315 known_map_->FindInCodeCache( | 315 known_map_->FindInCodeCache( |
316 strict() ? | 316 strict() ? |
317 *factory->strict_compare_ic_string() : | 317 *factory->strict_compare_ic_string() : |
318 *factory->compare_ic_string(), | 318 *factory->compare_ic_string(), |
319 flags), | 319 flags), |
320 isolate); | 320 isolate); |
321 if (probe->IsCode()) { | 321 if (probe->IsCode()) { |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 // already active, as the hooks won't stack. | 641 // already active, as the hooks won't stack. |
642 if (entry_hook != 0 && entry_hook_ != 0) | 642 if (entry_hook != 0 && entry_hook_ != 0) |
643 return false; | 643 return false; |
644 | 644 |
645 entry_hook_ = entry_hook; | 645 entry_hook_ = entry_hook; |
646 return true; | 646 return true; |
647 } | 647 } |
648 | 648 |
649 | 649 |
650 } } // namespace v8::internal | 650 } } // namespace v8::internal |
OLD | NEW |