OLD | NEW |
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 // Nested stubs are not allowed for leafs. | 55 // Nested stubs are not allowed for leafs. |
56 AllowStubCallsScope allow_scope(masm, AllowsStubCalls()); | 56 AllowStubCallsScope allow_scope(masm, AllowsStubCalls()); |
57 | 57 |
58 // Generate the code for the stub. | 58 // Generate the code for the stub. |
59 masm->set_generating_stub(true); | 59 masm->set_generating_stub(true); |
60 Generate(masm); | 60 Generate(masm); |
61 } | 61 } |
62 | 62 |
63 | 63 |
64 SmartPointer<const char> CodeStub::GetName() { | 64 SmartArrayPointer<const char> CodeStub::GetName() { |
65 char buffer[100]; | 65 char buffer[100]; |
66 NoAllocationStringAllocator allocator(buffer, | 66 NoAllocationStringAllocator allocator(buffer, |
67 static_cast<unsigned>(sizeof(buffer))); | 67 static_cast<unsigned>(sizeof(buffer))); |
68 StringStream stream(&allocator); | 68 StringStream stream(&allocator); |
69 PrintName(&stream); | 69 PrintName(&stream); |
70 return stream.ToCString(); | 70 return stream.ToCString(); |
71 } | 71 } |
72 | 72 |
73 | 73 |
74 void CodeStub::RecordCodeGeneration(Code* code, MacroAssembler* masm) { | 74 void CodeStub::RecordCodeGeneration(Code* code, MacroAssembler* masm) { |
75 code->set_major_key(MajorKey()); | 75 code->set_major_key(MajorKey()); |
76 | 76 |
77 Isolate* isolate = masm->isolate(); | 77 Isolate* isolate = masm->isolate(); |
78 SmartPointer<const char> name = GetName(); | 78 SmartArrayPointer<const char> name = GetName(); |
79 PROFILE(isolate, CodeCreateEvent(Logger::STUB_TAG, code, *name)); | 79 PROFILE(isolate, CodeCreateEvent(Logger::STUB_TAG, code, *name)); |
80 GDBJIT(AddCode(GDBJITInterface::STUB, *name, code)); | 80 GDBJIT(AddCode(GDBJITInterface::STUB, *name, code)); |
81 Counters* counters = isolate->counters(); | 81 Counters* counters = isolate->counters(); |
82 counters->total_stubs_code_size()->Increment(code->instruction_size()); | 82 counters->total_stubs_code_size()->Increment(code->instruction_size()); |
83 | 83 |
84 #ifdef ENABLE_DISASSEMBLER | 84 #ifdef ENABLE_DISASSEMBLER |
85 if (FLAG_print_code_stubs) { | 85 if (FLAG_print_code_stubs) { |
86 code->Disassemble(*name); | 86 code->Disassemble(*name); |
87 PrintF("\n"); | 87 PrintF("\n"); |
88 } | 88 } |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 } | 403 } |
404 | 404 |
405 | 405 |
406 bool ToBooleanStub::Types::CanBeUndetectable() const { | 406 bool ToBooleanStub::Types::CanBeUndetectable() const { |
407 return Contains(ToBooleanStub::SPEC_OBJECT) | 407 return Contains(ToBooleanStub::SPEC_OBJECT) |
408 || Contains(ToBooleanStub::STRING); | 408 || Contains(ToBooleanStub::STRING); |
409 } | 409 } |
410 | 410 |
411 | 411 |
412 } } // namespace v8::internal | 412 } } // namespace v8::internal |
OLD | NEW |