| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 995 ASSERT(state < STACK_STATE_MAX); | 995 ASSERT(state < STACK_STATE_MAX); |
| 996 stack_state_start_addresses_[state] = addr; | 996 stack_state_start_addresses_[state] = addr; |
| 997 } | 997 } |
| 998 #endif | 998 #endif |
| 999 | 999 |
| 1000 SmartArrayPointer<char> GetFilename() { | 1000 SmartArrayPointer<char> GetFilename() { |
| 1001 return String::cast(script_->name())->ToCString(); | 1001 return String::cast(script_->name())->ToCString(); |
| 1002 } | 1002 } |
| 1003 | 1003 |
| 1004 int GetScriptLineNumber(int pos) { | 1004 int GetScriptLineNumber(int pos) { |
| 1005 return GetScriptLineNumberSafe(script_, pos) + 1; | 1005 return script_->GetLineNumber(pos) + 1; |
| 1006 } | 1006 } |
| 1007 | 1007 |
| 1008 | 1008 |
| 1009 private: | 1009 private: |
| 1010 const char* name_; | 1010 const char* name_; |
| 1011 Code* code_; | 1011 Code* code_; |
| 1012 Handle<Script> script_; | 1012 Handle<Script> script_; |
| 1013 GDBJITLineInfo* lineinfo_; | 1013 GDBJITLineInfo* lineinfo_; |
| 1014 GDBJITInterface::CodeTag tag_; | 1014 GDBJITInterface::CodeTag tag_; |
| 1015 CompilationInfo* info_; | 1015 CompilationInfo* info_; |
| (...skipping 980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1996 reinterpret_cast<intptr_t>(ptr) & ~kLineInfoTag); | 1996 reinterpret_cast<intptr_t>(ptr) & ~kLineInfoTag); |
| 1997 } | 1997 } |
| 1998 | 1998 |
| 1999 | 1999 |
| 2000 void GDBJITInterface::AddCode(Handle<Name> name, | 2000 void GDBJITInterface::AddCode(Handle<Name> name, |
| 2001 Handle<Script> script, | 2001 Handle<Script> script, |
| 2002 Handle<Code> code, | 2002 Handle<Code> code, |
| 2003 CompilationInfo* info) { | 2003 CompilationInfo* info) { |
| 2004 if (!FLAG_gdbjit) return; | 2004 if (!FLAG_gdbjit) return; |
| 2005 | 2005 |
| 2006 // Force initialization of line_ends array. | 2006 Script::InitLineEnds(script); |
| 2007 GetScriptLineNumber(script, 0); | |
| 2008 | 2007 |
| 2009 if (!name.is_null() && name->IsString()) { | 2008 if (!name.is_null() && name->IsString()) { |
| 2010 SmartArrayPointer<char> name_cstring = | 2009 SmartArrayPointer<char> name_cstring = |
| 2011 Handle<String>::cast(name)->ToCString(DISALLOW_NULLS); | 2010 Handle<String>::cast(name)->ToCString(DISALLOW_NULLS); |
| 2012 AddCode(name_cstring.get(), *code, GDBJITInterface::FUNCTION, *script, | 2011 AddCode(name_cstring.get(), *code, GDBJITInterface::FUNCTION, *script, |
| 2013 info); | 2012 info); |
| 2014 } else { | 2013 } else { |
| 2015 AddCode("", *code, GDBJITInterface::FUNCTION, *script, info); | 2014 AddCode("", *code, GDBJITInterface::FUNCTION, *script, info); |
| 2016 } | 2015 } |
| 2017 } | 2016 } |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2191 LockGuard<Mutex> lock_guard(mutex.Pointer()); | 2190 LockGuard<Mutex> lock_guard(mutex.Pointer()); |
| 2192 ASSERT(!IsLineInfoTagged(line_info)); | 2191 ASSERT(!IsLineInfoTagged(line_info)); |
| 2193 HashMap::Entry* e = GetEntries()->Lookup(code, HashForCodeObject(code), true); | 2192 HashMap::Entry* e = GetEntries()->Lookup(code, HashForCodeObject(code), true); |
| 2194 ASSERT(e->value == NULL); | 2193 ASSERT(e->value == NULL); |
| 2195 e->value = TagLineInfo(line_info); | 2194 e->value = TagLineInfo(line_info); |
| 2196 } | 2195 } |
| 2197 | 2196 |
| 2198 | 2197 |
| 2199 } } // namespace v8::internal | 2198 } } // namespace v8::internal |
| 2200 #endif | 2199 #endif |
| OLD | NEW |