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

Side by Side Diff: src/handles.cc

Issue 1079006: Add basic C++ implementation of CPU profiler. (Closed)
Patch Set: Comments addressed Created 10 years, 9 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
« no previous file with comments | « src/handles.h ('k') | src/ia32/codegen-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 if ((Smi::cast(line_ends_array->get(left + half)))->value() > code_pos) { 507 if ((Smi::cast(line_ends_array->get(left + half)))->value() > code_pos) {
508 right -= half; 508 right -= half;
509 } else { 509 } else {
510 left += half; 510 left += half;
511 } 511 }
512 } 512 }
513 return right + script->line_offset()->value(); 513 return right + script->line_offset()->value();
514 } 514 }
515 515
516 516
517 int GetScriptLineNumberSafe(Handle<Script> script, int code_pos) {
518 AssertNoAllocation no_allocation;
519 if (!script->line_ends()->IsUndefined()) {
520 return GetScriptLineNumber(script, code_pos);
521 }
522 // Slow mode: we do not have line_ends. We have to iterate through source.
523 if (!script->source()->IsString()) {
524 return -1;
525 }
526 String* source = String::cast(script->source());
527 int line = 0;
528 int len = source->length();
529 for (int pos = 0; pos < len; pos++) {
530 if (pos == code_pos) {
531 break;
532 }
533 if (source->Get(pos) == '\n') {
534 line++;
535 }
536 }
537 return line;
538 }
539
540
517 void CustomArguments::IterateInstance(ObjectVisitor* v) { 541 void CustomArguments::IterateInstance(ObjectVisitor* v) {
518 v->VisitPointers(values_, values_ + 4); 542 v->VisitPointers(values_, values_ + 4);
519 } 543 }
520 544
521 545
522 // Compute the property keys from the interceptor. 546 // Compute the property keys from the interceptor.
523 v8::Handle<v8::Array> GetKeysForNamedInterceptor(Handle<JSObject> receiver, 547 v8::Handle<v8::Array> GetKeysForNamedInterceptor(Handle<JSObject> receiver,
524 Handle<JSObject> object) { 548 Handle<JSObject> object) {
525 Handle<InterceptorInfo> interceptor(object->GetNamedInterceptor()); 549 Handle<InterceptorInfo> interceptor(object->GetNamedInterceptor());
526 CustomArguments args(interceptor->data(), *receiver, *object); 550 CustomArguments args(interceptor->data(), *receiver, *object);
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 Handle<Map> new_map = Factory::CopyMapDropTransitions(old_map); 862 Handle<Map> new_map = Factory::CopyMapDropTransitions(old_map);
839 obj->set_map(*new_map); 863 obj->set_map(*new_map);
840 new_map->set_needs_loading(true); 864 new_map->set_needs_loading(true);
841 // Store the lazy loading info in the constructor field. We'll 865 // Store the lazy loading info in the constructor field. We'll
842 // reestablish the constructor from the fixed array after loading. 866 // reestablish the constructor from the fixed array after loading.
843 new_map->set_constructor(*arr); 867 new_map->set_constructor(*arr);
844 ASSERT(!obj->IsLoaded()); 868 ASSERT(!obj->IsLoaded());
845 } 869 }
846 870
847 } } // namespace v8::internal 871 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/handles.h ('k') | src/ia32/codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698