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

Side by Side Diff: src/builtins.cc

Issue 5965011: Basic GDB JIT Interface integration. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: minor formatting cleanup Created 9 years, 11 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
OLDNEW
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 13 matching lines...) Expand all
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #include "v8.h" 28 #include "v8.h"
29 29
30 #include "api.h" 30 #include "api.h"
31 #include "arguments.h" 31 #include "arguments.h"
32 #include "bootstrapper.h" 32 #include "bootstrapper.h"
33 #include "builtins.h" 33 #include "builtins.h"
34 #include "gdbjit.h"
34 #include "ic-inl.h" 35 #include "ic-inl.h"
35 #include "vm-state-inl.h" 36 #include "vm-state-inl.h"
36 37
37 namespace v8 { 38 namespace v8 {
38 namespace internal { 39 namespace internal {
39 40
40 namespace { 41 namespace {
41 42
42 // Arguments object passed to C++ builtins. 43 // Arguments object passed to C++ builtins.
43 template <BuiltinExtraArguments extra_args> 44 template <BuiltinExtraArguments extra_args>
(...skipping 1494 matching lines...) Expand 10 before | Expand all | Expand 10 after
1538 typedef void (*Generator)(MacroAssembler*, int, BuiltinExtraArguments); 1539 typedef void (*Generator)(MacroAssembler*, int, BuiltinExtraArguments);
1539 Generator g = FUNCTION_CAST<Generator>(functions[i].generator); 1540 Generator g = FUNCTION_CAST<Generator>(functions[i].generator);
1540 // We pass all arguments to the generator, but it may not use all of 1541 // We pass all arguments to the generator, but it may not use all of
1541 // them. This works because the first arguments are on top of the 1542 // them. This works because the first arguments are on top of the
1542 // stack. 1543 // stack.
1543 g(&masm, functions[i].name, functions[i].extra_args); 1544 g(&masm, functions[i].name, functions[i].extra_args);
1544 // Move the code into the object heap. 1545 // Move the code into the object heap.
1545 CodeDesc desc; 1546 CodeDesc desc;
1546 masm.GetCode(&desc); 1547 masm.GetCode(&desc);
1547 Code::Flags flags = functions[i].flags; 1548 Code::Flags flags = functions[i].flags;
1548 Object* code = 0; 1549 Object* code = 0;
Erik Corry 2011/01/05 09:00:15 Not your code, but this should be NULL. Also it s
Vyacheslav Egorov (Chromium) 2011/01/18 16:10:42 We get it from ToObject() which does not provide g
1549 { 1550 {
1550 // During startup it's OK to always allocate and defer GC to later. 1551 // During startup it's OK to always allocate and defer GC to later.
1551 // This simplifies things because we don't need to retry. 1552 // This simplifies things because we don't need to retry.
1552 AlwaysAllocateScope __scope__; 1553 AlwaysAllocateScope __scope__;
1553 { MaybeObject* maybe_code = 1554 { MaybeObject* maybe_code =
1554 Heap::CreateCode(desc, flags, masm.CodeObject()); 1555 Heap::CreateCode(desc, flags, masm.CodeObject());
1555 if (!maybe_code->ToObject(&code)) { 1556 if (!maybe_code->ToObject(&code)) {
1556 v8::internal::V8::FatalProcessOutOfMemory("CreateCode"); 1557 v8::internal::V8::FatalProcessOutOfMemory("CreateCode");
1557 } 1558 }
1558 } 1559 }
1559 } 1560 }
1560 // Log the event and add the code to the builtins array. 1561 // Log the event and add the code to the builtins array.
1561 PROFILE(CodeCreateEvent(Logger::BUILTIN_TAG, 1562 PROFILE(CodeCreateEvent(Logger::BUILTIN_TAG,
1562 Code::cast(code), functions[i].s_name)); 1563 Code::cast(code),
1564 functions[i].s_name));
1565 GDBJIT(AddCode(GDBJITInterface::BUILTIN,
1566 functions[i].s_name,
1567 Code::cast(code)));
1563 builtins_[i] = code; 1568 builtins_[i] = code;
1564 #ifdef ENABLE_DISASSEMBLER 1569 #ifdef ENABLE_DISASSEMBLER
1565 if (FLAG_print_builtin_code) { 1570 if (FLAG_print_builtin_code) {
1566 PrintF("Builtin: %s\n", functions[i].s_name); 1571 PrintF("Builtin: %s\n", functions[i].s_name);
1567 Code::cast(code)->Disassemble(functions[i].s_name); 1572 Code::cast(code)->Disassemble(functions[i].s_name);
1568 PrintF("\n"); 1573 PrintF("\n");
1569 } 1574 }
1570 #endif 1575 #endif
1571 } else { 1576 } else {
1572 // Deserializing. The values will be filled in during IterateBuiltins. 1577 // Deserializing. The values will be filled in during IterateBuiltins.
(...skipping 24 matching lines...) Expand all
1597 if (entry->contains(pc)) { 1602 if (entry->contains(pc)) {
1598 return names_[i]; 1603 return names_[i];
1599 } 1604 }
1600 } 1605 }
1601 } 1606 }
1602 return NULL; 1607 return NULL;
1603 } 1608 }
1604 1609
1605 1610
1606 } } // namespace v8::internal 1611 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698